there was the closing variable element missing. sorry
 
<xsl:template match="your_row_generating_element">
<fo:table-row>
<xsl:variable name=color>
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<xsl:text>blue</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:variable>
<xsl:text>red</xsl:text>
</xsl:otherwise>
<fo:table-cell background-color="{$color}">
<fo:block>
your text
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template >
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 11. April 2006 11:57
An: 'fop-users@xmlgraphics.apache.org'
Betreff: AW: FOP - help in alternate color setting in table

You'll have to use a modulo function in xslt.
 
<xsl:template match="your_row_generating_element">
<fo:table-row>
<xsl:variable name=color>
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<xsl:text>blue</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>red</xsl:text>
</xsl:otherwise>
<fo:table-cell background-color="{$color}">
<fo:block>
your text
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template >
 
jan
-----Ursprüngliche Nachricht-----
Von: Debasish Jana [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 11. April 2006 11:42
An: fop-users@xmlgraphics.apache.org
Betreff: FOP - help in alternate color setting in table

Hi:

 

Is there any way to set alternate colors for rows and columns for a fo:table? For example, I would like to set the first row as red, second as blue, third as red and so on.

 

If there is no such attribute to do so, is there any workaround to accomplish this?

 

Pls help.

 

Regards,

 

Debasish Jana

 

Reply via email to