You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by foobar <fk...@gmail.com> on 2012/08/16 17:31:16 UTC
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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Variables
Posted by foobar <fk...@gmail.com>.
Thank you, guys.
Regards
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Variables-tp36660p36667.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: Variables
Posted by "Amick, Eric" <Er...@mail.house.gov>.
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:rmeyer@hotmail.co.uk]
Sent: Friday, August 17, 2012 6:39
To: fop-users@xmlgraphics.apache.org
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: fknopf@gmail.com
> To: fop-users@xmlgraphics.apache.org
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
RE: Variables
Posted by Robert Meyer <rm...@hotmail.co.uk>.
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: fknopf@gmail.com
> To: fop-users@xmlgraphics.apache.org
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
Re: Variables
Posted by Glenn Adams <gl...@skynav.com>.
you need to study XSLT to learn how to translate to XSL-FO; FOP only
performs the XSLT processing as a convenience function for users; it's real
input is XSL-FO
On Thu, Aug 16, 2012 at 11:31 PM, foobar <fk...@gmail.com> wrote:
>
>
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>