Using XSLT to add background image
I have a PDF ZEN report module that I'm using
What I need is for a particular value to add a background image to the <item> that is calling the XSLFoXslt
The code I have is the following but all that happens is the color.
{
<xsl:template name="HighLight">
<xsl:param name="Value"/>
<xsl:attribute name='background-image'>url("images/trash-icon.png")</xsl:attribute>
<xsl:attribute name='background-repeat'>no-repeat</xsl:attribute>
<xsl:attribute name='color'>#ffffff</xsl:attribute> </xsl:if>
}
Product version: Caché 2018.1
Hi Con
I think your problem might be that background-image and background-repeat are CSS properties, not HTML attributes. Color works because it is an HTML attribute (although you should use the CSS style property for this as well these days).
Try:
<xsl:if test="$Value = 400">
<xsl:attribute name='style'>background-image: url("images/trash-icon.png"); background-repeat: no-repeat;</xsl:attribute>
<xsl:attribute name='color'>#ffffff</xsl:attribute>
</xsl:if>
If that works then you might want to consider using a class attribute to reference a stylesheet rather than including a style attribute directly, but that's another matter.
George
Thanks George but unfortunately the pdf fails to render.
Hi Con
Check the url reference to the image.
George
Hi Con
Actually, xsl-fo has it's own way of styling so what I suggested, which would work for html, probably isn't applicable for xsl-fo.
George
Thank you for your time on this.
George,
With reference the PDF errors and does not appear at all.
Con
If there is no way to add image to the XSLT template, is it possible to add ↑ for up arrow?
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue