Given the following XML:
<items>
<item>
<name>A</name>
<address>0</address>
<start>0</start>
<size>2</size>
</item>
<item>
<name>B</name>
<address>1</address>
<start>2</start>
<size>4</size>
</item>
<item>
<name>C</name>
<address>2</address>
<start>5</start>
<size>2</size>
</item>
</items>
I want to generate the following output including colspan's
+---------+------+------+------+------+------+------+------+------+
| Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---------+------+------+------+------+------+------+------+------+
| 0 | | | | | | | A |
+---------+------+------+------+------+------+------+------+------+
| 1 | | | B | | |
+---------+------+------+------+------+------+------+------+------+
| 2 | | C | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 3 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
I think I would be able to accomplish this with a mutable xslt variable, but alas, there's no such thing.
Is it even possible? How?
Edit:
Two more requirements:
- It must also be possible for two items to exist at the same address
- Empty addresses may exist and must be generated in the output
For example:
<items>
<item>
<name>D</name>
<address>0</address>
<start>0</start>
<size>2</size>
</item>
<item>
<name>E</name>
<address>0</address>
<start>3</start>
<size>4</size>
</item>
<item>
<name>F</name>
<address>7</address>
<start>5</start>
<size>2</size>
</item>
</items>
Should yield:
+---------+------+------+------+------+------+------+------+------+
| Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---------+------+------+------+------+------+------+------+------+
| 0 | | E | | D |
+---------+------+------+------+------+------+------+------+------+
| 1 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 2 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 3 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 4 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 5 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 6 | | | | | | | | |
+---------+------+------+------+------+------+------+------+------+
| 7 | | F | | | | | |
+---------+------+------+------+------+------+------+------+------+
Output format (text/html) doesn't really matter.