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
+---------+------+------+------+------+------+------+------+------+ | Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---------+------+------+------+------+------+------+------+------+ | 0 | | | | | | | A | +---------+------+------+------+------+------+------+------+------+ | 1 | | | B | | | +---------+------+------+------+------+------+------+------+------+ | 2 | | C | | | | | | +---------+------+------+------+------+------+------+------+------+ | 3 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+
I think I could accomplish this with the xslt mutable variable, but alas, there is no such thing.
Is it possible? How?
Edit:
Two more requirements:
- It should also be possible for two elements to exist at the same address.
- Empty addresses can exist and must be generated at the output
For instance:
<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>
Must issue:
+---------+------+------+------+------+------+------+------+------+ | Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---------+------+------+------+------+------+------+------+------+ | 0 | | E | | D | +---------+------+------+------+------+------+------+------+------+ | 1 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 2 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 3 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 4 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 5 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 6 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ | 7 | | F | | | | | | +---------+------+------+------+------+------+------+------+------+
The output format (text / html) does not matter.
anorm source share