Lists Home |
Date Index |
> Umm, no.
> Node-sets are ordered sets. The spec spends (too much?) time
> discussing the ordering of returned sets, which depend upon the axis.
> So it isn't exactly true that they are always in document order
> (particularly if you're using a complex expression that moves in
> multiple axes), but it is true that the nodes are returned in
> the order
> of encounter, as specified by the axis. Typically, this
> means document
> They are *not* unordered sets.
Wrong. XPath 1.0 node-sets are unordered.
If you read the material in section 2.4 again, you will see that it says an
axis has direction, and that the proximity position of a node in a node-set
depends on the direction of the associated axis. But it never says that
node-sets themselves are ordered, or that the nodes are "returned" in any
particular order. You might find the section easier to understand (I
certainly do) if you think of a node-set derived from a forwards axis as
being a list of nodes in document order, and a node-set derived from a
reverse axis as being a list of nodes in reverse document order, but the
spec very deliberately doesn't describe it that way.