This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Sorting and Grouping revisited
David Carlisle wrote:
>
> > 'am I crazy for expecting XSLT to be able to handle sorting and
> > grouping gracefully?'
>
>
> However all is not lost. You can access the sorted list by doing
>
> <xsl:variable name="x">
> <xsl:for-each....
> <xsl:sort/>
> ....
> </xsl:variable>
>
> then use it as in
>
> <xsl:apply-templates select="exslt:node-set($x)"/>
>
> where exslt: is the prefix for your processors extension namespace.
> All the major XSLT systems (I think) offer a node-set() function for
> this use.
>
Interesting - at first glance I thought that this broke the principle
that node-set expressions and variables don't have an independent order
property, that they use either the document order or an order dictated
by their XSLT or Xpath context.
Then I realised that because the new node-set was created by value
rather than by reference the nodes are actually in "RTF order", as when
the variable was created.
I suspect this won't be the last time that this property of node-set()
catches me out!
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list