You can simplify that considerably:
<xsl:template match="image">
<fo:block>
<fo:external-graphic src="url('{.}')" />
</fo:block>
</xsl:template>
Eric Amick Systems Engineer II
Legislative Computer Systems
From: Robert Meyer [mailto:[email protected]]
Sent: Friday, August 17, 2012 6:39
To: [email protected]
Subject: RE: Variables
Hi,
This is really an XSLT question rather than a FOP question and would be best
asked on an appropriate forum.
However, I have done something similar in the past and this is how I did it:
file.xml
=====
<image>somepath/image.png</image>
templates.xsl
========
<xsl:template match="image">
<xsl:param name="imageVar">
<xsl:value-of select="text()" />
</xsl:param>
<fo:block>
<fo:external-graphic src="url('{$imageVar}')" />
</fo:block>
</xsl:template>
Regards,
Robert Meyer
> Date: Thu, 16 Aug 2012 08:31:16 -0700
> From: [email protected]
> To: [email protected]
> Subject: Variables
>
>
>
> Hi,
>
> i am quite new to FOP, so i need a little help.
>
> The XML file comes with a dynamically created tag, that holds the path to an
> image:
>
> <user>
> <id>001</id>
> <name>foo</name>
> <familyname>bar</familyname>
> <image>/somepath/foo_bar_001.jpg</image>
> </user>
>
> How can i use the image content in the XSLT ? That the result is:
>
> <fo:external-graphic width="200px" height="40px"
> content-width="scale-to-fit" content-height="scale-to-fit"
> src="/somepath/foo_bar_001.jpg"/>
>
> Do i need to load the <xs:value-of select="image"/> into a variable ?
>
>
> Thank you,
> Regards
> Foobar
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-fop.1065347.n5.nabble.com/Variables-tp36660.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>