Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Recursive processing of an XML document

From: "kloppie" <kloppnr1@-------.--->
To: NULL
Date: 7/9/2005 12:54:00 AM
Hi there,

i have a basic understanding of xsl, but now i need some recursive
processing of a xml-document.
The xml-document consists of a series of nodes which together form a
tree - this is done by a parent/child relationship between the rows.

But how do i come from my flat xml-document to a nested document?
Look below for the source document and desired output document:

My XML source:

<Table>
	<Node ID="1" ParentID="0" Text="1" />
	<Node ID="2" ParentID="1" Text="1.1" />
	<Node ID="3" ParentID="2" Text="1.1.1" />
	<Node ID="4" ParentID="2" Text="1.1.2" />
	<Node ID="5" ParentID="2" Text="1.1.3" />
	<Node ID="6" ParentID="1" Text="1.2" />
	<Node ID="7" ParentID="6" Text="1.2.1" />
</Table>

My desired XML transformed output:

<?xml version="1.0" encoding="utf-8" ?>
<TREENODES>
<treenode text="1">
  <treenode text="1.1">
    <treenode text="1.1.1" />
    <treenode text="1.1.2" />
    <treenode text="1.1.3" />
  </treenode>
  <treenode text="1.2">
    <treenode text="1.2.1"/>
  </treenode>
</treenode>
>/TREENODES>

I want the xsl to run down the tree and create treenode start-tags as
long as there is children - and on the way back up the tree the
end-tags have to be inserted.

Can anybody help me out on this one? -Martin



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent