[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl can't get graphic to load from xml file

Subject: Re: xsl can't get graphic to load from xml file
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Thu, 7 Apr 2005 15:43:26 -0500
fo external graphic file
Errr, it looks like you sent two emails to the email list with almost
the exact same subject and the exact same body text.

I responded to the other one, but I don't know if you read
that....I'll add it below, but this is bound to be confusing if
someone looks in the archive.  It is possible, although you might have
to play with the code I have below.

What I believe Eliot is trying to warn you about is that the approach
you are taking is not very flexible.  If you generate the fo document
at a separate time from when you process the fo file (the output from
the xslt transformation) there is the possibility that the path to the
image is no longer correct.  Say you generate fo on system x using
your system.  The url to those documents then change (someone moves
the images up  a folder).   If you then attempt to create a pdf from
the fo file you'll find your images are gone.

Remember, XSLT and XSL-FO are different specs (although they are XSL)
and many people use one without the other.  I'd recommend again that
you try to separate out when you're using xslt to produce an xsl-fo
document and when you are using the xsl-fo document to create another
document.  They are two different processes.  I find that it helps the
learning process if you keep them separate.  Otherwise it can get too
confusing.



==========================================================
Text of my response to your other posting below 
==========================================================

So...is there a reason you need to use that template setup?

Why not just
<xsl:template name="getLogo">
      <fo:external-graphic src="url({invoice/images/logo})"/>
</xsl:template>

Or even better yet:
<xsl:template match="logo">
   <fo:external-graphic src="url({.})"/>
</xsl:template>

If you absolutely must use the two templates, why not something like
(might vary a bit depending on how you treat namespaces I think) :

<xsl:template name="logo">
        <xsl:value-of select="invoice/images/logo"/>
</xsl:template>

<xsl:template name="getLogo">
         <xsl:element name="fo:external-graphic">
                         <xsl:attribute name="src">
                            <xsl:text>url(</xsl:text>
                            <xsl:call-template name="logo"/>
                            <xsl:text>)</xsl:text>
                         </xsl:attribute>
          </xsl:element>
</xsl:template>

Plus, you may want to keep in mind the earlier advice on this list
about not all processors working with the path information you're
using.  Try to provide an actual url (should have that file:// on the
start)

Jon G.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.