On Jul 26, 2005, at 19:13, [EMAIL PROTECTED] wrote:

Hi,

... something still seems to be wrong, when i do so, the PDF gets generated, but no table is build, and i found this exception in the logs:

java.lang.ArrayIndexOutOfBoundsException: -2
at org.apache.fop.fo.flow.TableRow$CellArray.getNextFreeCell(TableRow.java :130)
<snip />

Where is this exception thrown and why ?! The XSL:FO code is:

<xsl:template match="table">
  <fo:table border="0.5pt solid black" table-layout="auto"
            width="100%" space-before.optimum="1pt"
            space-after.optimum="2pt">
<xsl:param name="columnsCounter" select="/child::tr/attribute::maxCols"/> <fo:table-column width="30" number-columns-repeated="{$columnsCounter}"/>

FOP 0.20.5 doesn't implement 'number-columns-repeated' --nor table-layout="auto"--, but this just isn't at all clear from the exception.

Apart from implementing the property yourself in FOP 0.20.5 --which isn't hard to do actually-- your only option seems to be to create separate fo:table-columns via XSLT. Based on your example, this can be achieved like so:

<xsl:template match="table">
  <fo:table ...>
    <xsl:call-template name="columns">
      <xsl:with-param name="pCols" select="/tr/@maxCols" />
    </xsl:call-template>
    <!-- remainder of table definition -->
  </fo:table>
</xsl:template>

<xsl:template name="columns">
  <xsl:param name="pCols" select="1" />

  <xsl:if test="$pCols &gt; 0">
    <fo:table-column ...>
    <xsl:call-template name="columns">
      <xsl:with-param name="pCols" select="$pCols - 1" />
    </xsl:call-template>
  </xsl:if>
</xsl:template>

The $pCols parameter could just as easily be derived from the structure of the table, say:

  <xsl:with-param name="pCols" select="count(tr[1]/*)" />

to have it match the number of child elements in the first row of the table in scope.


HTH!

Greetz,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to