Re: [xsl] Sorting and Grouping revisited

Subject: Re: [xsl] Sorting and Grouping revisited
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Thu, 19 Apr 2001 11:03:22 +0100

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


Current Thread