You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Rachael Blank <bl...@mars-systems.com> on 2002/01/04 18:45:57 UTC

FOP-XSL:dynamic external graphics

Hello and thanks in advance for your help!

Is there a way I can dynamically display images based on an xml tag that
I am given?

I receive the following xml:
<client>
   <id></id>
   ...
</client>

I currently have the following uri specification and it works:
<fo:external-graphic src="file:../default/tra-app/images/chclogo.gif"/>

I need the image name (chclogo.gif) to change depending on the
<client><id>a number</id></client> that I receive in the xml.

I thought something like this would work:
<fo:table-cell>
   <fo:block
       white-space-collapse="true">
       <xsl:variable name="filepathValue" 
           
select="concat('file:../default/tra-app/images/',client/id,'logo.gif')"
/>     
       <fo:external-graphic src="$filepathValue" />
       <xsl:value-of select="$filepathValue" /><!--Error checking-->
   </fo:block>
</fo:table-cell>

I am receiving the following error with the above code:
Error while creating area : Invalid Image URL - error on relative URL :
java.lang.NullPointerException

I am sure that I have the correct path (because the $filepathValue
displays correctly on the screen via my value-of select statement), but
I am thinking it is not possible to pass a variable into the src element
of the fo:external-graphic statement.  I also made sure this image is
correctly named and in the appropriate directory.

Any thoughts or alternatives, anyone?

Thanks!

Rachael










Can I

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org