Subject:Column Span Problem Author:Anu Nair Date:22 Mar 2006 03:03 AM
Hi,
I am having a problem in XML transformation to XSL-FO.
The problem is with transforming a table cell which has to span 2 or more columns.
Below is the XML for the same.
<table>
<colspec column-name="x" column-width="25%"/>
<colspec column-name="y" column-width="50%"/>
<colspec column-name="z" column-width="25%"/>
<tbody>
<row>
<cell>data1</cell>
<cell colstart="y" colend="z">data2</cell>
</row>
</tbody>
</table>
The problem is I have to get the column numbers (start and end) and subtract to arrive at the number-columns-spanned for the table cell.
I tried doing this:
1. Loop through the colspec tags to check whether the column name matches with the end column name.
2. If column names match, set the fo:table-cell attribute "number-columns-spanned" to the end column number (using position()).
3. Loop through the colspec tags again to match the start column.
4. If columns match, get the current value of attribute number-column-spanned and subtract the start column number from it.
This would be the columns spanned value.
<!--i am getting the current value of the no.-cols-spanned attribute here-->
<xsl:variable name="nocolspan" select="number-columns-spanned"/>
<!--getting the start col number and subtracting from current value of attribute to get the new no.-cols-spanned value-->
<xsl:variable name="startcolumn" select="@colstart"/>