Re: [xsl] Reverse order axis operators...

Subject: Re: [xsl] Reverse order axis operators...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 12 Jan 2002 16:35:09 GMT

> All the reference material abd W3c reading says that these four Axis should
> return node-list in reverse document order.
They are reverse axese but that only means that they essentially collect
their nodes in reverse order so ancestor::*[1] is the parent, ie the
first ancestor going up.

However the value of such an Xpath expression is a node set. Sets
(unlike lists) do not have an order. So it does not matter whether you
collect nodes using a forward or reverse axis or a combination of the
two, the resuult of an expression is always an unordered set.

When you come to iterate over that set using xsl:for-each the for-each
sorts then into document order or some other order specified by xsl:sort
but note it is the for-each (or copy-of) taht is ordering the set not
that the set itself has any intrinsic order that "remembers" the order
in which it was selected.

David
PS
a)this is a FAQ I'm sure that the faq for this list has more info
b) this is an XPath 1 answer. In the Xpath2 working draft (which is a
very new draft and not in msxml) the semantix of these expressions are 
described in terms of sequences (ie ordered lists) rather than unordered
sets, but the result is the same a for-each iterating over ancesto::*
iterates over the nodes in document (forwards) order.



_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread