(Note: I have posted a variation on my earlier question as suggested)
Given an input xml file with following structure:
<widgets>
<widget shape="square" material="wood" color="red" />
<widget shape="square" material="metal" color="blue" />
<widget shape="square" material="plastic" color="green" />
<widget shape="square" material="kevlar" color="red" />
<widget shape="round" material="metal" color="orange" />
<widget shape="round" material="wood" color="green" />
<widget shape="round" material="kevlar" color="blue" />
<widget shape="diamond" material="plastic" color="blue" />
<widget shape="diamond" material="wood" color="brown" />
<widget shape="diamond" material="metal" color="red" />
</widgets>
And the following information:
- Each widget has a shape, material and color
- Each shape, material and color combination is unique
- Not every combination of shape, material and color exists eg there is no round, plastic widget
- There can be unlimited shapes, materials and colors
- The desired output is a table of where each row represents a shape and each column represents a material.
How can I output the following structure using XSLT?
<table>
<tr id="diamond">
<td class="kevlar"></td>
<td class="metal red"></td>
<td class="plastic blue"></td>
<td class="wood brown"></td>
</tr>
<tr id="round">
<td class="kevlar blue"></td>
<td class="metal orange"></td>
<td class="plastic"></td>
<td class="wood green"></td>
</tr>
<tr id="square">
<td class="kevlar green"></td>
<td class="metal blue"></td>
<td class="plastic green"></td>
<td class="wood red"></td>
</tr>
</table>