I have a xml document on the following format and want to transform it using a xsl template.
I’m a beginner at xsl transformations and I only need to know how to recurse trough the tree but a solution to the whole problem would be nice.
This is the xml document:
<?xml version="1.0" encoding="UTF-8" ?>
<nodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node>
<type>Parent</type>
<name>.test</name>
<node>
<type>parent</type>
<name>.test.root</name>
<node>
<type>Parent</type>
<name>.test.root.group</name>
<node>
<type>int</type>
<name>.test.root.group.a</name>
<value>0</value>
</node>
<node>
<type>char</type>
<name>.test.root.group.b</name>
<value>-</value>
</node>
</node>
</node>
<node>
<type>parent</type>
<name>.test.versions</name>
<node>
<type>utf-8</type>
<name>.test.versions.version</name>
<value>alpha</value>
</node>
<node>
<type>utf-8</type>
<name>.test.version.extra</name>
<value>16.5</value>
</node>
</node>
</node>
</nodes>
And this is how I would like the produced html to look like:
.---------------------------------------------.
| tree | value | type |
|------------------------+-----------+--------|
| '- test | | parent |
| |- root | | parent |
| | '- group | | parent |
| | |- a | 0 | int |
| | '- b | - | char |
| '- versions | | parent |
| |- version | "alpha" | utf-8 |
| '- extra | 16.5 | utf-8 |
'---------------------------------------------'
This XSLT will generate a tree like you want:
Adding data to next two columns is pretty simple, try to do it by yourself.