I want to transform table like this:
<table>
<thead>
<tr>
<th rowspan="3">th11</th>
<th>th12</th>
<th rowspan="2">th13</th>
<th colspan="2">th14</th>
</tr>
<tr>
<th>th21</th>
<th>th22</th>
<th>th23</th>
</tr>
<tr>
<th>th31</th>
<th>th32</th>
<th>th33</th>
<th>th34</th>
</tr>
</thead>
</table>
to this table:
<table>
<thead>
<tr>
<th rowspan="3">th11</th>
<th>th12</th>
<th rowspan="2">th13</th>
<th colspan="2">th14</th>
</tr>
<tr>
<th></th>
<th>th21</th>
<th></th>
<th>th22</th>
<th>th23</th>
</tr>
<tr>
<th></th>
<th>th31</th>
<th>th32</th>
<th>th33</th>
<th>th34</th>
</tr>
</thead>
</table>
In fact I want to put empty cells below cells with rowspan, according to rowspan number. cells' rowspan and colspan attributes should be appeared in final result.
<xsl:for-each select="tr">
<xsl:value-of select="sum(th[@colspan]/@colspan) + count(th[not(@colspan)])"/>
</xsl:for-each>
I want this code to give me the same numbers.
How can I do this using XSLT? What is the appropriate algorithm for this purpose? Any help would be appreciated.