Re: [xsl] Sorting out rowspans

Subject: Re: [xsl] Sorting out rowspans
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 11 Feb 2008 17:03:17 +0000
On 11/02/2008, Spencer Tickner <spencertickner@xxxxxxxxx> wrote:
> Hi List,
>
> Thanks in advance for any help. I'm having a hard time figuring a
> little bit of XSLT,, Monday maybe. I'm reprocessing some XML from an
> Indesign file and trying to figure out how to re-group rowspans.
>
> What I have.
>
> <tr>
>   <td>col1</td>
>   <td rowspan="2">col2</td>
> </tr>
> <tr>
>   <td>col1</td>
>   <td>col1</td>
> </tr>
> <tr>
>   <td>col2</td>
> </tr>
>
> Which should be processed to create:
>
> <tr>
>   <td>col1</td>
>   <td rowspan="2">col2</td>
> </tr>
> <tr>
>   <td>col1</td>
> </tr>
> <tr>
>   <td>col1</td>
>   <td>col2</td>
> </tr>
>
> Any thoughts on a nice way of doing this.. I'm using XSLT 2.0.


I think you'll need a clearer definition of the problem, and even then
it's reasonable task to sort that out.

You could try normalizing the table:

http://andrewjwelch.com/code/xslt/table/table-normalization.html

...then use the normalized table to determine which cells need to be
moved, but it's definitely not a trivial task.

cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread