Subject: RE: [Fwd: RE: Need help OR'ing in XPATH.]
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Mar 2006 12:45:57 -0000
|
> I saw the |
> operator earlier but was concerned that it won't guarantee that it
> *would* be in document order. The XPath spec seems to be vague on
> this[1] -- i.e., whether I can guarantee document order with
> it, *or* it
> just so happens that they way the major XSLT implementations
> implement
> this operator result in it being in document order.
In XPath 1.0 / XSLT 1.0 the position is:
XPath constructs a node-set. A node-set has no intrinsic ordering (the order
of the nodes is undefined/unpredictable). But XSLT instructions such as
xsl:for-each and xsl:apply-templates, in the absence of an xsl:sort, always
process the nodes in a node-set in document order: see for example
http://www.w3.org/TR/xslt#for-each
"The nodes are processed in document order, unless a sorting specification
is present (see [10 Sorting])."
The way this works in 2.0 has changed, though the effect is the same. XPath
2.0 now delivers a sequence of nodes, and XSLT processes that sequence in
the order supplied. For path expressions and union expressions (among
others) the sequence is always in document order.
Michael Kay
http://www.saxonica.com/
|