| Author |
Background image in XSL-FO from XML field
|
francisco zenha
Greenhorn
Joined: Oct 03, 2008
Posts: 3
|
|
Hi, I need to have a background image to a table. That�s easy to do if we put the path on the url of the background image but my problem is that the path is on an XML field and i need to get it on the XSL-FO. How could i do this? Thanks [ October 03, 2008: Message edited by: francisco zenha ] [ October 03, 2008: Message edited by: francisco zenha ]
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
I can imagine several possibilities, but since I don't exactly understand what you wrote there, could you post a small example of your input and your desired output? And an example of what you tried so far would help too.
|
 |
francisco zenha
Greenhorn
Joined: Oct 03, 2008
Posts: 3
|
|
I have this: <fo:block-container width="20cm" height="21.6cm" background-image="image2.jpg"> what i want is that it gets the image2.jpg path from a field in the XML <image2>image2.jpg</image2> because this way i can change the path and name of the photo on the XML and never have to change the XSL file. what i�ve tried was to include in the background-image an <fo:external-graphic> like this: <fo:external-graphic> <xsl:attribute name="src"> <xsl:text>url(</xsl:text> <xsl:call-template name="double-backslash"> <xsl:with-param name="text"> <xsl:value-of select="string(image1)"/> </xsl:with-param> <xsl:with-param name="text-length"> <xsl:value-of select="string-length(string(image1))"/> </xsl:with-param> </xsl:call-template> <xsl:text>)</xsl:text> </xsl:attribute> </fo:external-graphic> I�ve tried to put this inside: <fo:block-container width="20cm" height="21.6cm" background-image="url(<fo:external-graphic>...)"> But these don�t work. Any idea? Thanks
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
Well, that seems rather complicated to me. Why not just use an attribute-value template (AVT) to populate the background-image attribute, something like this: You'd put an XPath expression inside the {braces} which produces the required text as its result when coerced to a string.
|
 |
 |
|
|
subject: Background image in XSL-FO from XML field
|
|
|