xsl-list
[Top] [All Lists]

[xsl] Grouping adjacent columns in a table

2010-01-15 09:05:48
Hello

I have an XHTML table which can have an arbitrary number of columns and rows.

For display purposes, I need to reduce the number of columns by grouping 
adjacent duplicate columns.

Therefore.

<table border="1" rules="all">
        <thead>
<tr>
        <th>A</th>
        <th>B</th>
        <th>C</th>
        <th>D</th>
        <th>E</th>
</tr>
        </thead>
        <tbody>
<tr>
        <td>100</td>
        <td>100</td>
        <td>200</td>
        <td>200</td>
        <td>300</td>
</tr>
<tr>
        <td>400</td>
        <td>500</td>
        <td>500</td>
        <td>500</td>
        <td>500</td>
</tr>
<tr>
        <td>600</td>
        <td>600</td>
        <td>700</td>
        <td>700</td>
        <td>800</td>
</tr>
<tr>
        <td>900</td>
        <td>900</td>
        <td>900</td>
        <td>900</td>
        <td>900</td>
</tr>
        </tbody>
</table>

becomes

<table border="1" rules="all">
        <thead>
<tr>
        <th>A</th>
        <th>B</th>
        <th>C,D</th>
        <th>E</th>
</tr>
        </thead>
        <tbody>
<tr>
        <td>100</td>
        <td>100</td>
        <td>200</td>
        <td>300</td>
</tr>
<tr>
        <td>400</td>
        <td>500</td>
        <td>500</td>
        <td>500</td>
</tr>
<tr>
        <td>600</td>
        <td>600</td>
        <td>700</td>
        <td>800</td>
</tr>
<tr>
        <td>900</td>
        <td>900</td>
        <td>900</td>
        <td>900</td>
</tr>
        </tbody>
</table>

as columns 'C' and 'D' contain duplicate values. The real data could contain up 
to 50 columns and grouping could span several columns.

I can utilise a XSLT 2.0 solution.

Any help you be appreciated.

--
Kevin
  




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>