xsl attribute for background-color not working

Here should go questions about transforming XML with XSLT and FOP.
CDickson
Posts: 6
Joined: Fri Jun 24, 2011 4:56 pm

xsl attribute for background-color not working

Post by CDickson »

Hello.

I have set a top level variable for a colour using

<xsl:variable name="my_colour">
<xsl:value-of select="yellow"/>
</xsl:variable>

I have a table defined and I want this variable to be used a s the background colour for a cell so i have added an attribute for background-color witrhthin the block for the cell

<xsl:attribute name="background-color">
<xsl:value-of select="$my_colour"/>
</xsl:attribute>

When I view the fo output it does have the attraibute added but it is null like the following

background-color=""

If I manually add in a colour between the "" and trnasform it then it is fine. Does anyoen know why the fo is not generated to include my colour?

Thanks,

Colm
ionela
Posts: 407
Joined: Mon Dec 05, 2011 6:08 pm

Re: xsl attribute for background-color not working

Post by ionela »

Hello,

Please note that you should enclose the color within apostrophes in order to be evaluated as a string. Otherwise, the <xsl:value-of> element is trying to extract the value of an XML element called yellow.

Code: Select all


<xsl:variable name="my_colour">
<xsl:value-of select=" 'yellow' "/>
</xsl:variable>
Let us know if you need further assistance.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
CDickson
Posts: 6
Joined: Fri Jun 24, 2011 4:56 pm

Re: xsl attribute for background-color not working

Post by CDickson »

Hello,

yes,thanks for that. It has resolved my problem.

Regards,

Colm
Post Reply