Page 1 of 1

xsl attribute for background-color not working

Posted: Thu Sep 20, 2012 8:26 pm
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

Re: xsl attribute for background-color not working

Posted: Thu Sep 20, 2012 9:54 pm
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

Re: xsl attribute for background-color not working

Posted: Fri Sep 21, 2012 11:23 am
by CDickson
Hello,

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

Regards,

Colm