Reputation: 3590
So I am trying to pass background color as parameter to the table-cell for an PDF XSLT.
<xsl:template name="colorCell">
<xsl:param name="bgColor"/>
<fo:table-cell border="solid 1pt gray" background-color="$bgColor">
....
</fo:table-cell>
</xsl:template>
But somehow it ends up as being set to background-color="$bgColor"> instead of background-color="red">
This is how I am calling the template:
<xsl:call-template name="colorCell">
<xsl:with-param name="bgColor" select="'white'"/>
</xsl:call-template>
This is the error:
SEVERE: Invalid property value encountered in background-color="$bgColor"
Am I doing it wrong? Any ideas? Last note I am using FOP for generating pdf
Upvotes: 2
Views: 650
Reputation: 23627
If it's a variable you need to place it in an attribute value template:
<fo:table-cell border="solid 1pt gray" background-color="{$bgColor}">
See: Attribute Value Templates
Upvotes: 1