[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

transforming flat data to hierarchical data. Recursion

Subject: transforming flat data to hierarchical data. Recursion??
From: "dave peeters" <elechi76@xxxxxxxxxxx>
Date: Fri, 06 Jun 2003 09:39:32 +0200
dave peeters
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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.