[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: xpath question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Jul 2003 12:24:01 +0100
  what is the difference between these xpaths:
  //table/tgroup/tbody/row[1]/entry[1]/child::node()[1]
  and
  //table/tgroup/tbody/row[1]/entry[1]/ce[1]
  //table/tgroup/tbody/row[1]/entry[1]/para[1]


node() matches all kinds of nodes so child::node()[1] which is
the same as node()[1] matches the first node which, in your case is a
text node consisting of a single newline character.

You want
*[1]
which will select the first element node.

(Try to avoid // if you can, it os a very expensive operation)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • xpath question
    • abbouh - Fri, 4 Jul 2003 07:02:54 -0400 (EDT)
      • David Carlisle - Fri, 4 Jul 2003 07:24:44 -0400 (EDT) <=
      • Jeni Tennison - Fri, 4 Jul 2003 07:27:53 -0400 (EDT)
      • <Possible follow-ups>
      • abbouh - Wed, 9 Jul 2003 09:29:46 -0400 (EDT)
        • David Carlisle - Wed, 9 Jul 2003 09:50:03 -0400 (EDT)
          • abbouh - Wed, 9 Jul 2003 10:20:33 -0400 (EDT)
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member