Maybe you want this, instead.

<xsl:if test="@statusImageURL">
  <fo:block >
    <fo:external-graphic src="[EMAIL PROTECTED]"/>
    <xsl:value-of select="@status"/>
  </fo:block>
</xsl:if>
-- 
Charles Knell
[EMAIL PROTECTED] - email



-----Original Message-----
From:     Daling Xu <[EMAIL PROTECTED]>
Sent:     Fri, 30 Nov 2007 10:00:40 -0800 (PST)
To:       [email protected]
Subject:  anything wrong with this XSL snippet

Hi,
   
  I am using FOP to generate PDF from an XML doc.
   
  In my PDF, I would like to insert image in some places, but because not every 
time I have an image for all the element in the xml, I use a XSL:If statement 
like this way:
  <fo:block >
  <xsl:if test="@statusImageURL"><fo:external-graphic src="[EMAIL 
PROTECTED]"/></xsl:if>
  <xsl:value-of select="@status"/> 
  </fo:block>
   
  My XML element looks like:
  <ElementName statusImageURL="urlxyz" status="mystatusString" />
  Here the 'statusImageURL'  is an optional attr, my intention is that if an 
element has a statusImageURL attr, the fo generated should be:
   
  <fo:block><fo:external-graphic src="My URL XYZ"/>myStatusString123</fo:block>
   
  But for an XML element without a statusImageURL, the fo should be:
  <fo:block>myStatusString123</fo:block>
   
  But in my actual case, the system always generate something like
  <fo:block><fo:external-graphic src=""/>myStatusString123</fo:block>
  even my xml doesn't have the 'statusImageURL'   attr, and this finally cause 
FOP an exception of 
  Error while recovering image information () : null
   
  org.apache.fop.fo.flow.ExternalGraphic bind
  SEVERE: Image not available: 
   
  Any idea what's wrong with my XSLT?
  
Thanks
   
  Linda

       
---------------------------------
Get easy, one-click access to your favorites.  Make Yahoo! your homepage.

ÿþ<div>Hi,</div> <div>&nbsp;</div> <div>I am using FOP to generate PDF from an XML doc.</div> <div>&nbsp;</div> <div>In my PDF, I would like to insert image in some places, but because not every time I have an image for all the element in the xml, I use a XSL:If statement like this way:</div> <div><FONT size=2>&lt;fo:block &gt;</div> <div align=left>&lt;xsl:if test="[EMAIL PROTECTED]"&gt;&lt;fo:external-graphic src="[EMAIL PROTECTED]"/&gt;&lt;/xsl:if&gt;</div> <div align=left>&lt;xsl:value-of select="[EMAIL PROTECTED]"/&gt; </div> <div>&lt;/fo:block&gt;</div> <div>&nbsp;</div> <div>My XML element looks like:</div> <div>&lt;ElementName statusImageURL="urlxyz" status="mystatusString" /&gt;</div> <div>Here the 'statusImageURL'&nbsp; is an optional attr, my intention is that if an element has a statusImageURL attr, the fo generated should be:</div> <div></FONT>&nbsp;</div> <div>&lt;fo:block&gt;&lt;fo:external-graphic src="My URL XYZ"/&gt;myStatusString123&lt;/fo:block&gt;</div> <div>&nbsp;</div> <div>But for an XML element without a statusImageURL, the fo should be:</div> <div>&lt;fo:block&gt;myStatusString123&lt;/fo:block&gt;</div> <div>&nbsp;</div> <div>But in my actual case, the system always generate something like</div> <div>&lt;fo:block&gt;&lt;fo:external-graphic src=""/&gt;myStatusString123&lt;/fo:block&gt;</div> <div>even my xml doesn't have the 'statusImageURL'&nbsp;&nbsp; attr, and this finally cause FOP an exception of </div><FONT color=#ff0000 size=2> <div>Error while recovering image information () : null</div></FONT> <div>&nbsp;</div><FONT color=#ff0000 size=2> <div align=left>org.apache.fop.fo.flow.ExternalGraphic bind</div> <div>SEVERE: Image not available: </div> <div>&nbsp;</div> <div>Any idea what's wrong with my XSLT?</div> <div><BR>Thanks</div> <div>&nbsp;</div> <div>Linda</div></FONT><p>&#32; <hr size=1>Get easy, one-click access to your favorites. <a href="http://us.rd.yahoo.com/evt=51443/*http://www.yahoo.com/r/hs"> Make Yahoo! your homepage.</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to