You picked a particularly vexing example to start with.

//foo is interpreted as /descendent-or-self:*/child:foo, so its order is
breadth-first. (d-or-s and child both return results in document order, but
this combination applies child to each d-or-s in succession).

Similar non-obvious results can occur with other descendant cases, or when
one or more of the reverse axes (parent, preceeding, preceeding-sibling) is
used.

But most individual (non-reverse) primitive XPath operations do return
nodes in document order.

See the XPath spec for details. Note too that it isn't uncommon for users
of XPath, such as XSLT's apply-template operation, to put the nodes back in
document order before processing them.


______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Reply via email to