Hi,
I have a base XML file that I want to use it as the source for a XMLDatasource object that is feeding a treeView object (.NET 2.0). I've included a sample copy of my base XML below; the XML is representing a tree in a recursive manner. I need to exclude the tags <node> and <Nodes> in the XML while maintaining the relationships between the Val tags, having the following hierarchy in my treeview.
I now this can be done probably using an XLS or while I'm binding the data to my treeView object. Any hint would help,
Thanks,
Robert
DTreeNodeOfOBSTeamTeam0
Team10
Team1001
Team1002
// Sample copy of the base XML
< xml version="1.0" encoding="utf-8" >
<DTreeNodeOfOBSTeam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<val>
<TeamName>Team0</TeamName>
</val>
<Nodes>
<node>
<val>
<TeamName>Team10</TeamName>
</val>
<Nodes>
<node>
<val>
<TeamName>Team1001</TeamName>
</val>
<Nodes />
</node>
<node>
<val>
<TeamName>Team1002</TeamName>
</val>
<Nodes />
</node>
</Nodes>
</node>
</Nodes>
</DTreeNodeOfOBSTeam>

XML transformation for web treeview 2.0
sud
In your XML sample "val" elements don't have relationship with each other. So without "Nodes" and "node" elements XML become:
XSLT for this is:
You may want to try the something like:
Which gives you:
To execute XSLT you can use XslCompiledTransform class.
Wayne Clements
Thanks much Sergey. I took me a while to digest it (I'm novice at XML) but I works like a charm.
Take care,
Robert
Stampede2