Hi again,
consider the following simplified source example, using Saxon B9 for transformation:
Code:
<table>
<tr> <td>11</td> <td>12</td> <td>13</td> </tr>
<tr> <td colspan="2">21+22</td> <td>23</td> </tr>
<tr> <td>31</td> <td rowspan="2">32+42</td> <td>33</td> </tr>
<tr> <td>41</td> <td>43</td> </tr>
<tr> <td colspan="2" rowspan="2">51+52+61+62</td> <td>53</td> </tr>
<tr> <td>63</td> </tr>
</table>
For my target application, I need to output something for every table cell, including those that are omitted in HTML because of the rowspan/colspan args. Just adding empty <td/> tags in the places where 22, 42, 52, 61 and 62 would be (violating HTML semantics) would be fine for that purpose, so that all rows would have a constant number of td tags.
The colspan part alone was easy, but rowspan is trickier, and the combination of both even more. I tried XPath expressions like
Code:
parent::node()/preceding-sibling::node()/td[position()=$mypos]
to access td tags in previous rows, but I'm somehow stuck thinking further (not that much experience with functional programming).
How would you do that?
Thanks in advance
Maik