Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2005, 10:39 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL-FO Question

Bit off the wall this one, I'm trying to insert a graphic into an FO document, however, the graphic used is dependant on a value in the source XML, this is my code...

<xsl:variable name="imgsrc" select="concat('/fop-0.20.5/images/', /ehub_document/ehub_from, '.jpg')"/>

<fo:external-graphic src="$imgsrc"/>

When using the Apache FOP tool to convert the FO doc to PDF it is seeing $imgsrc as a literal, i.e. it is looking for a file called $imgsrc! If I omit the quotes from the src attribute, it then complains that quotes are expected.

Up until now I've just done this with a big <xsl:when>, but the number of options is now approaching 10 and it's getting a bit ugly! E.g.
<xsl:choose>
  <xsl:when test="/ehub_document/ehub_from = 'foo'">
    <fo:external-graphic src="foo.jpg"/>
  </xsl:when>
</xsl:choose>

Anyone know if this is possible? Bit of a long shot I know :)

Gray

 
Old February 18th, 2005, 11:31 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Found the answer in another post here.

<fo:external-graphic src="{$imgsrc}"/>

The curly braces force the content to be evaluated as an XPath expression. Works a treat :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML to PDF via XSL-FO NEO1976 XSLT 2 September 8th, 2006 06:47 AM
XSL-FO NEO1976 XML 2 July 19th, 2006 10:10 AM
xsl:fo with Select Birger XSLT 4 July 18th, 2006 11:38 AM
A good XSL-FO forum? lthompso XSLT 3 March 22nd, 2006 06:51 AM
hello, some problems with XSL-FO LuisMM XSLT 4 December 19th, 2003 02:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.