I am looking for a script filter that can take a cleaned HTML table containing colspan & rowspan attributes and un-combine/split them into their own cell.
Input would look something like this:
Code: Select all
<table>
<tr>
<td colspan="4">abcd</td>
<td>e</td>
</tr>
<tr>
<td>f</td>
<td>g</td>
<td>h</td>
<td colspan="2">ij</td>
</tr>
<tr>
<td>k</td>
<td>l</td>
<td colspan="2" rowspan="2">mnrs</td>
<td>o</td>
</tr>
<tr>
<td rowspan="2">pu</td>
<td>q</td>
<td>t</td>
</tr>
<tr>
<td>v</td>
<td>w</td>
<td>x</td>
<td>y</td>
</tr>
</table>
Code: Select all
<table>
<tr>
<td>abcd</td>
<td>abcd</td>
<td>abcd</td>
<td>abcd</td>
<td>e</td>
</tr>
<tr>
<td>f</td>
<td>g</td>
<td>h</td>
<td>ij</td>
<td>ij</td>
</tr>
<tr>
<td>k</td>
<td>l</td>
<td>mnrs</td>
<td>mnrs</td>
<td>o</td>
</tr>
<tr>
<td>pu</td>
<td>q</td>
<td>mnrs</td>
<td>mnrs</td>
<td>t</td>
</tr>
<tr>
<td>pu</td>
<td>v</td>
<td>w</td>
<td>x</td>
<td>y</td>
</tr>
</table>
Exp: <td>abcd</td><td>abcd</td><td>abcd</td><td>abcd</td>
rowspan is a little more tricky, as you need to track the placement of the rowspan containing tag and insert it x times in the same location in rows below it.
Thanks for any help,
Brent