[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: positional predicates in XPath vs XQL
> 1 section > 2 para > 3 para > 4 section > 5 para > 6 section > 7 para > 8 para > 9 para > > [Note that this is not a well-formed XML document, though XPath > can work on well-formed text entities such as this.] Right. > The XPath is equivalent to the expanded syntax > /child::section/child::para[position()=1]. The first / selects the root > node. The next expression selects all <section> children of the root - > nodes 1, 4, and 6 in your example. The next expression, child::para, > selects nodes for each node in its context. For node 1, nodes 2 > and 3 are selected; for node 4, node 5 is selected; for node 6, nodes 7, 8, > and 9 are selected. For each node set, the predicate is evaluated, > returning true for nodes 2, 5, and 7, as they are each the first in their node set. Ah, that was what I needed. I had just spent 1/2 hour trying the parse the English in the section of the XPath specification on predicates and had obviously failed miserably. Your example makes it much clearer. Thanks, Howard > ~Chris > > P.S. YM "ratiocination". HTH. HAND. Huh? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|