Re: [xsl] Sorting and navigation

Subject: Re: [xsl] Sorting and navigation
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 6 Sep 2007 11:33:29 +0100
On 9/6/07, Coppens Benont (All4IT) <Benoit.Coppens@xxxxxxxxxxxxx> wrote:
> Hi,
>
> From the source provided below, I woud like to build the following table:
>
> ID | AUTHOR | NEXT | PREVIOUS
> -----------------------------
> 13 | CA     | 45   | *
> 45 | CA     | 12   | 13
> 12 | GE     | 5    | 45
> 5  | MA     | 3    | 12
> 3  | MB     | *    | 5
>
> Table must be sorted first by Author and then by ID
> Next and Previous columns contain the ID of the next/previous document
>
> How is it possible using XSLT1.0 and only one XSLT?

It is possible.  For the sorting use multiple sorts:

<xsl:sort select="AUTHOR"/>
<xsl:sort select="ID" data-type="number"/>

For the next/previous just do:

select="follow-sibling::*[1]/ID"

and

select="preceding-sibling::*[1]/ID"

respectively.



--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread