Subject: Re: [xsl] Reverse axis, reverse document order, xsl:for-each From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Thu, 28 Feb 2008 12:02:43 +0100 |
XSLT 1.0 models the result of any path expression as a set of nodes in no particular order. The semantics of xsl:for-each are that it processes this set in the order determined by its xsl:sort specification; the default for this is "document order".
You can reverse this using <xsl:sort select="position()" order="descending" data-type="number"/>
The way the semantics are modelled changes significantly in XSLT 2.0, though of course backwards compatiblity has been retained.
Why is this so?
Depends who you ask. Committees move in mysterious ways. It can be hard to work out why a decision was made even if you were present at all the meetings - which in this case, I wasn't.
Mysterious ways. Easy enough to accept. Especially with the above-mentioned position() trick at hand. I won't question further.
And, last question, is there a way to have a pointer (xsl:variable) to nodes in RDO without resorting to copying or reconstructing?
Not in 1.0: the type system only allows sets of nodes, not sequences. 2.0 changes that.
Michael Kay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Reverse axis, reverse doc, Michael Kay | Thread | [xsl] Insert elment in XSD, igutierrez027 |
RE: [xsl] XSLT 2.0 XML Schema defin, Michael Kay | Date | RE: [xsl] passing a sequence as a p, Robert Walpole |
Month |