Re: [xsl] transforming flat data to hierarchical data. Recursion??

Subject: Re: [xsl] transforming flat data to hierarchical data. Recursion??
From: "Agnes Kielen" <a.kielen@xxxxxxx>
Date: Fri, 6 Jun 2003 10:17:06 +0200
Hi,

Did you already look at grouping:
http://www.jenitennison.com/xslt/grouping/index.html

Cheers,
Agnes
----- Original Message -----
From: "dave peeters" <elechi76@xxxxxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, June 06, 2003 9:39 AM
Subject: [xsl] transforming flat data to hierarchical data. Recursion??


> I'm having the following structure in an XML file
>
> ...
> <Pages>
> <PAGE id="1">
> ...
> <Next id="2"/>
> </PAGE>
> <PAGE id="2">
> ...
> <Next id="3"/>
> </PAGE>
> <PAGE id="3">
> ...
> </PAGE>
> <PAGE id="4">
> ...
> <Next id="5"/>
> </PAGE>
> <PAGE id="5">
> ...
> </PAGE>
> ...
> </Pages>
> ...
>
> And need to get to the following
> ...
> <Pages>
> <PAGE id="1">
> ...
> <Next>
> <PAGE id="2">
> ...
> <Next>
> <PAGE id="3">
> ...
> </PAGE>
> </Next>
> </PAGE>
> </Next>
> </PAGE>
> <PAGE id="4">
> ...
> <Next>
> <PAGE id="5">
> ...
> </PAGE>
> </Next>
> </PAGE>
> </Pages>
> ...
>
> I think I need to use recursion but I cannot get the output I want.
> I tried replacing every /Next/@id with its matching element using a
xsl:key
> on the PAGE elements based on id
> but that only replaces on one level and since I don't know the lenght of
the
> linked lists I cannot use this principle.
>
> Does anybody have an idea how to solve this
> I'm not really that familiar with xslt
>
> Kind regards
> Dave
>
> _________________________________________________________________
> Hotmail: je gratis e-mail ! http://www.msn.be/hotmail
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>



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


Current Thread