This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]