Re: [xsl] Reverse axis, reverse document order, xsl:for-each

Subject: Re: [xsl] Reverse axis, reverse document order, xsl:for-each
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 28 Feb 2008 09:56:16 GMT
>  Why is this so? Why does xsl:for-each obliterate the direction
>  offered by the axis?  

It does not. You are using XSLt 1.0 and Xpath 1.0 has no datatype fr
storing ordered sequences. A node set is a  _set_ and sets are
intrinsically unordered constructs. the sets {1,2,3} {3,2,1}
{1,1,3,3,2,2} are all identical.

The axis order specifies the direction to go while collecting nodes, but
once they are collected they just go into the set and operations on them
work with this unordered collection, perhaps (as in the case of
xsl:for-each) sorting the nodes into document order before processing
them. If you need a different order, then you can use  xsl:sort.

If you use xslt 2 then the underlying datatype changes from sets to
ordered sequences and then variables can hold sequences in specific
order (and xsl:for-each will also iterate over the sequence in order)


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread