xsl-list
[Top] [All Lists]

Re: [xsl] Sorting and navigation

2007-09-06 03:33:35
On 9/6/07, Coppens Benoît (All4IT) 
<Benoit(_dot_)Coppens(_at_)ucb-group(_dot_)com> 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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>