You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2006/12/12 14:15:22 UTC
svn commit: r486128 - in /forrest/trunk:
main/webapp/skins/common/xslt/fo/document-to-fo.xsl
whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft
Author: thorsten
Date: Tue Dec 12 05:15:21 2006
New Revision: 486128
URL: http://svn.apache.org/viewvc?view=rev&rev=486128
Log:
Fixing calculation of number-columns-repeated for the <fo:table-column/>.
The problem have been with the "old" calculation that if one only use colspan attributes then one never get the right amount of columns.
e.g.
<table>
<tr>
<td colspan="10" rowspan="1">CONDICIONES DE ORDENACION</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Suelo neto edificable</td>
<td colspan="4" rowspan="1">Mínimo espacios libres</td>
<td colspan="4" rowspan="1">Mínimo equipamiento</td>
<td colspan="1" rowspan="1">Mínima cesión aprovechamiento</td>
</tr>
<!--...-->
</table>
The old calculation would have returned 4 as $max-number-columns but it is 10, leading fop to throw the error
"java.lang.ArrayIndexOutOfBoundsException: -2" (without stack trace). Took me some time to find out why this error was thrown.
Modified:
forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft
Modified: forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl?view=diff&rev=486128&r1=486127&r2=486128
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl (original)
+++ forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl Tue Dec 12 05:15:21 2006
@@ -814,13 +814,38 @@
Unfortunately, this means that each column is a fixed width,
but at least the table displays! -->
- <xsl:variable name="max-number-columns">
+ <xsl:variable name="max-number-columns-td">
<xsl:for-each select="tr">
- <xsl:sort select="count(td|th)" data-type="number" order="descending"/>
+ <xsl:sort select="count(td|th)" data-type="number"
+ order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="count(td|th)"/>
</xsl:if>
</xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="max-number-columns-colspan">
+ <xsl:for-each select="tr">
+ <xsl:sort select="count(td|th)" data-type="number"
+ order="descending"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of
+ select="sum(td/@colspan|th/@colspan)"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="max-number-columns">
+ <xsl:choose>
+ <xsl:when
+ test="$max-number-columns-colspan>max-number-columns-td">
+ <xsl:value-of
+ select="$max-number-columns-colspan"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$max-number-columns-td"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft?view=diff&rev=486128&r1=486127&r2=486128
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/fo/content.ft Tue Dec 12 05:15:21 2006
@@ -947,7 +947,7 @@
Unfortunately, this means that each column is a fixed width,
but at least the table displays! -->
- <xsl:variable name="max-number-columns">
+ <xsl:variable name="max-number-columns-td">
<xsl:for-each select="tr">
<xsl:sort select="count(td|th)" data-type="number"
order="descending"/>
@@ -955,6 +955,27 @@
<xsl:value-of select="count(td|th)"/>
</xsl:if>
</xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="max-number-columns-colspan">
+ <xsl:for-each select="tr">
+ <xsl:sort select="count(td|th)" data-type="number"
+ order="descending"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="sum(td/@colspan|th/@colspan)"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="max-number-columns">
+ <xsl:choose>
+ <xsl:when test="$max-number-columns-colspan>max-number-columns-td">
+ <xsl:value-of select="$max-number-columns-colspan"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$max-number-columns-td"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
<xsl:variable name="column-width">