xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Stanley" <jstan...@infinitecampus.com>
Subject RE: AW: build dynamic tables with FOP
Date Tue, 26 Jul 2005 20:51:33 GMT
I use number-columns-repeated often and I use 0.20.5.  I'd have to test
to be sure, but I think your problem may be the fact that you are using
a variable as a value, which won't work because the value needs to be
known at compile time.

The following works fine for me (note the static value 11). 

<fo:table-column column-width="65pt" number-columns-repeated="11"/> 

Just use a <xsl:for-each> to build your <fo:table-columns>

I believe a xsl:for-each will achieve what your after.

<xsl:for-each select="...">
	<fo:table-column width=".."/>
</xsl:for-each>


-----Original Message-----
From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Sent: Tuesday, July 26, 2005 3:35 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: AW: build dynamic tables with FOP

On Jul 26, 2005, at 19:13, Jens-Christian.Pohl@t-systems.com 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.jav
> a
> :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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message