Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Recursive processing of an XML document Recursive processing of an XML documentTo: 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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
