Given an input xml file with following structure:
<root>
<record row="1" col="1" val="1" />
<record row="1" col="2" val="2" />
<record row="1" col="3" val="3" />
<record row="1" col="n" val="4" />
<record row="2" col="1" val="5" />
<record row="2" col="3" val="6" />
<record row="2" col="n" val="7" />
<record row="n" col="2" val="8" />
<record row="n" col="3" val="9" />
<record row="n" col="n" val="10" />
</root>
How can I output the following structure using XSLT?
<root>
<row id="1">
<col id="1">1</col>
<col id="2">2</col>
<col id="3">3</col>
<col id="n">4</col>
</row>
<row id="2">
<col id="1">5</col>
<col id="2"></col>
<col id="3">6</col>
<col id="n">7</col>
</row>
<row id="n">
<col id="1"></col>
<col id="2">8</col>
<col id="3">9</col>
<col id="n">10</col>
</row>
</root>
[Note how all columns are output even if there is no related element in input]
EDIT: I may have caused confusion through the use of numbers and letters in my example. The solution I am looking for needs to handle row and column attributes that are non-numeric.