I have an XML document with following structure:
- root element DataModel can have children Node, Integer and String
- Node element can have children Node, Integer and String as well
E.g.:
<DataModel>
<String name="a">aaa</String>
<Integer name="b">bbb</Integer>
<Node name="n1">
<String name="k">kkk</String>
<Integer name="l">lll</Integer>
<Node name="n2">
<String name="x">xxx</String>
</Node>
</Node>
</DataModel>
I’d like to process this XML, flattening the output, but bringing the hierarchical structure in the naming, like so:
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td>a</td>
<td>aaa</td>
</tr>
<tr>
<td>b</td>
<td>bbb</td>
</tr>
<tr>
<td>n1.k</td>
<td>kkk</td>
</tr>
<tr>
<td>n1.l</td>
<td>lll</td>
</tr>
<tr>
<td>n1.n2.x</td>
<td>xxx</td>
</tr>
</table>
Any ideas how to do this?
Use this template:
Applied to XML:
Will produce desired output: