I got some hierarchical XML:
<node text="a" value="1">
<node text="gga" value="5">
<node text="dh" value="9">
<node text="tyfg" value="4">
</node>
</node>
</node>
<node text="dfhgf" value="7">
<node text="fdsg" value="2">
</node>
</node>
</node>
The names of the elements are the same up to the end ("node"), and the depth of the hierarchy is not known in advance - in the above example, the deepest sheet has four down, but can be any depth.
What I need to do is take this XML and smooth it into an HTML table. The number of columns in the table should be equal to the depth of the deepest element plus the column for the value attribute for each element. The "value" should appear in the rightmost column of the table, so the output rows cannot have dangling edges. For each node there should be a line, regardless of its level in. The above example should be converted to:
<table>
<tr>
<td>a</td>
<td></td>
<td></td>
<td></td>
<td>1</td>
</tr>
<tr>
<td>a</td>
<td>gga</td>
<td></td>
<td></td>
<td>5</td>
</tr>
<tr>
<td>a</td>
<td>gga</td>
<td>dh</td>
<td></td>
<td>9</td>
</tr>
<tr>
<td>a</td>
<td>gga</td>
<td>dh</td>
<td>tyfg</td>
<td>4</td>
</tr>
<tr>
<td>a</td>
<td>dfhgf</td>
<td></td>
<td></td>
<td>7</td>
</tr>
<tr>
<td>a</td>
<td>dfhgf</td>
<td>fdsg</td>
<td></td>
<td>2</td>
</tr>
</table>
Does anyone have a smart XSLT that can do this?