Hello everyone on the list,
> fact it worked out by changing the base XML to something like:
>
> <table>
> <columns cols="3" number="0"/>
> <columns cols="3" number="1"/>
> <columns cols="3" number="2"/>
> <tr>
> ....
I don't know if my approach to the tables is smart/correct, but i find it
myself quite easy, and now the XML does not have much overhead in it. XML looks
like:
--------------------------------------
<table caption="Table caption">
<tr>
<td>first row, first cell</td>
<td>first row, second cell</td>
</tr>
<tr>
<td>second row, first cell</td>
<td>second row, second cell</td>
</tr>
</table>
--------------------------------------
And XSL generates the FO code basically as follows:
--------------------------------------
<xsl:template match="table">
<fo:table table-layout="fixed">
<xsl:apply-templates select="child::*[position()=1]"
mode="calculate_columns"/>
<fo:table-body>
<xsl:apply-templates/>
</fo:table-body>
</fo:table>
</xsl:template>
<!-- contentWidth is specified as xsl:param -->
<xsl:template match="tr" mode="calculate_columns">
<xsl:variable name="columns" select="count(th|td)"/>
<xsl:variable name="column-width">
<xsl:value-of select="concat($contentWidth div $columns,'cm')"/>
</xsl:variable>
<xsl:for-each select="th|td">
<xsl:variable name="column-number">
<xsl:number level="multiple" count="th|td" format="1" />
</xsl:variable>
<fo:table-column column-number="{$column-number}"
column-width="{$column-width}"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="tr">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
<xsl:template match="th|td">
<fo:table-cell>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
--------------------------------------
Since this generates only equal width columns, I implemented width parameter to
the XML as well, and that is used instead of the calculated width if specified.
Maybe this helps, if you can specify the column widths in XML file's td|th
elements on the first tr?
rgds,
Jukka Ignatius
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 27. heinäkuuta 2005 10:59
> To: [email protected]
> Subject: AW: build dynamic tables with FOP
>
> Hi,
>
> thanks to everyone on the list helping me on this issue. In
> fact it worked out by changing the base XML to something like:
>
> <table>
> <columns cols="3" number="0"/>
> <columns cols="3" number="1"/>
> <columns cols="3" number="2"/>
> <tr>
> ....
>
> which enables me to react on it in the XSL:FO file:
>
> <xsl:for-each select="columns">
> <fo:table-column column-width="proportional-column-width(1)" />
> </xsl:for-each>
>
> and: which is leading me to another question - how can i
> optimise the width of the column ? I cannot fetch the width
> since its written in some CSS elsewhere on the server.
>
> Reading about this function "proportional-column-width(num)"
> i found out, that it might be used together with the
> table-layout='fixed' attribute value. But how can i estimate
> how much percentage i.e. should be calculated for the column
> or is there any kind of link between these
> functions/attributes to receive a kind of automation ?!
>
> Thanks + kind regards from Hamburg
>
> Jens
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Andreas L Delmelle [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 26. Juli 2005 22:54
> An: [email protected]
> Betreff: Re: AW: build dynamic tables with FOP
>
> On Jul 26, 2005, at 22:51, Jeff Stanley wrote:
>
> > I use number-columns-repeated often and I use 0.20.5.
>
> Sorry, must be an error on our compliance page then... It said no.
>
> http://xml.apache.org/fop/compliance.html#fo-property-number-columns-
> repeated
>
>
> Greetz,
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]