[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] sorting and grouping - can't get it to work


Subject: RE: [xsl] sorting and grouping - can't get it to work
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 2 Jul 2001 10:54:50 +0100

> Now for my question
>
> I have a little problem with data I want to sort and then place into a
> two-column table
> (two of the sorted data items in each row).
>
>
> <xsl:template match="data/item">
>     <table>
>         <xsl:for-each select="item[position() mod 2 = 1]">

Someone has already pointed out that your item elements don't occur as
children of a data/item.
>
> But what I really need is that the sorting of the item takes
> place before I
> start selecting some of them to start rows.
>
For a problem that involves sorting, then grouping, I recommend a two-phase
approach. Build a result tree fragment that contains the data in sorted
order, use the xx:node-set() extension function to convert this to a
node-set, and do the grouping in a second pass over this node-set.

Mike Kay
Software AG


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



Current Thread