Art said:
As I undertood:
XPath evaluates expressions to unordered node-sets.
The direction of axis in XPath is significant only when location step
contains predicates.
In other cases the order of nodes in a node-set defines by external to
XPath application (for example XSLT).
Am I right?
Not really, the ordering is intrinsic to the Xpath 1 data model, not
something added by XSLT. there is nothing strange about having sets
(that is, unordered sequeces) over a data type that is ordered.
Consider sets of integers for example, {1,2,3} and {1,3,2,1,2}
are the same set of three items, as sets are unorderd, however integers
are an ordered type and one can process those items in (say) ascending
order. Sets of nodes are no different. Node sets are unordered but there
is an ordering on nodes (irrespective of which set they are in) which
can be used in some (most) processing.
XPath/XSLt1 is always careful to distinguish a "node set" fom the
"current node list" the current node list is an ordered list and is what
is used to evaluate position() etc. In XPath1 though, the current node
list is a transient object that can not be returned as a result of an
expression.
All of this changes in XPath2 of course which has no node sets.
(Ordered) sequences replace both "node sets" and "current node lists".
This is useful for some things (for example you can save the result of
an xsl:sort as a (sorted) sequence) but the model is a lot less elegant
than XPath1, rather than the semantics of /, | and other set based
operators falling out naturally as a result of the set based semantics,
each of the "set" operators in XPath2 has to (on an operator-by-operator
basis) specify the sorting and removal of duplicates required to emulate
set semantics using an ordered sequence.
David