xsl-list
[Top] [All Lists]

Re: transforming flat data to hierarchical data. Recursion??

2003-06-06 01:17:06
Hi,

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

Cheers,
Agnes
----- Original Message -----
From: "dave peeters" <elechi76(_at_)hotmail(_dot_)com>
To: <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
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



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