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 cf...@kcp.com on 2004/12/21 16:22:31 UTC

Image Problem in FOP url(...)

I am trying to resolve my images dynamically.  When I perform the
following:
<fo:block>
  <xsl:variable name="pic" select="../Image[@larger]"/>
  <fo:external-graphic src="url(&quot;$pic&quot;)" content-height="201in"
scaling="uniform"></fo:external-graphic>
  Image=  <xsl:value-of select="$pic"/>
</fo:block>

I get this from Xalan:

<fo:block>
<fo:external-graphic scaling="uniform" content-height="201in" src="
url(&quot;$pic&quot;)"/>
Image= poiimages/thumb/9-30-2004-110395.jpg</fo:block>
</fo:table-cell>

As you can guess, url(&quot;$pic&quot;) is not correct.

I know this is a Xalan issue, but graphics rendered in HTML are added as
src attributes and they work fine.  This does not.  As you can see, the
$pic variable is working as it produces the proper path and image name from
the XML file. All the examples I find for graphics are with the image hard
coded into the url.  Please...   Can someone supply me with a clue as to
what I can do to make this work?  I have searched high and low in the Xalan
and FOP Apache bug lists, and there are no examples that point out this
behavior.  It seems as though the entire world is stuck with hard coded
images and they like it like that!  arrrgh!

Thanks, and a Merry Christmas and Happy Hanukah to everyone!

Curtis Fisher



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


Re: Image Problem in FOP url(...)

Posted by Chris Bowditch <bo...@hotmail.com>.
cfisher@kcp.com wrote:
> I am trying to resolve my images dynamically.  When I perform the
> following:
> <fo:block>
>   <xsl:variable name="pic" select="../Image[@larger]"/>
>   <fo:external-graphic src="url(&quot;$pic&quot;)" content-height="201in"
> scaling="uniform"></fo:external-graphic>
>   Image=  <xsl:value-of select="$pic"/>
> </fo:block>

Variables inside an attribute are not resolved by default, in xsl terms you 
have to use an attribute template: this means just put {} around the variable, 
e.g.

<fo:external-graphic src="url('{$pic}')"/>

I have just used single quotes instead of trying to use $quot; entity as its 
easier. Note that content-height doesnt have any effect in FOP 0.20.5.

<snip/>

Chris


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


Re: --- Potential SPAM ---: Re: Image Problem in FOP url(...)

Posted by cf...@kcp.com.
Thanks J., newbie mistake...  I get frustrated with the differences between
declaritive and procedural languages and I vent a little too much.  Having
been away from XSLT for a time, then coming back to it, there are new
topics to learn every day.  I thank you all for providing myself and the
larger community with your expertise and advice.

Curtis



                                                                           
             "J.Pietschmann"                                               
             <j3322ptm@yahoo.d                                             
             e>                                                         To 
                                       fop-user@xml.apache.org             
             12/21/2004 04:27                                           cc 
             PM                                                            
                                                                   Subject 
                                       --- Potential SPAM ---: Re: Image   
             Please respond to         Problem in FOP url(...)             
             fop-user@xml.apac                                             
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           




cfisher@kcp.com wrote:
> I am trying to resolve my images dynamically.
...
>   <fo:external-graphic src="url(&quot;$pic&quot;)" content-height="201in"
> scaling="uniform"></fo:external-graphic>
>   Image=  <xsl:value-of select="$pic"/>
...
> I get this from Xalan:
...
> <fo:external-graphic scaling="uniform" content-height="201in" src="
> url(&quot;$pic&quot;)"/>
...
> I know this is a Xalan issue ...
 > I have searched high and low in the Xalan
 > and FOP Apache bug lists,

Wrong place to look, Xalan works as designed here. It is more an
issue about your understanding how XSLT works.
The  src="url(&quot;$pic&quot;)" is copied through to the output
literally, exactly as the spec says. XSLT is not a macro language
where everything prefixed with a $ is substituted or somesuch.
If you want to have $pic evaluated in other places than select
and test attributes of certain XSLT elements, you have to say so
explicitely. In your case, the magic is named "attribute value template"
or short AVT (google it), and it means that parts of attribute values
which are enclosed in braces are evaluated as XPath expressions.
More specifically, use
  <fo:external-graphic src="url(&quot;{$pic}&quot;)" ...
                                      ^    ^
Check your favorite XSLT book or online tutorial for details.

J.Pietschmann

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




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


Re: Image Problem in FOP url(...)

Posted by "J.Pietschmann" <j3...@yahoo.de>.
cfisher@kcp.com wrote:
> I am trying to resolve my images dynamically.
...
>   <fo:external-graphic src="url(&quot;$pic&quot;)" content-height="201in"
> scaling="uniform"></fo:external-graphic>
>   Image=  <xsl:value-of select="$pic"/>
...
> I get this from Xalan:
...
> <fo:external-graphic scaling="uniform" content-height="201in" src="
> url(&quot;$pic&quot;)"/>
...
> I know this is a Xalan issue ...
 > I have searched high and low in the Xalan
 > and FOP Apache bug lists,

Wrong place to look, Xalan works as designed here. It is more an
issue about your understanding how XSLT works.
The  src="url(&quot;$pic&quot;)" is copied through to the output
literally, exactly as the spec says. XSLT is not a macro language
where everything prefixed with a $ is substituted or somesuch.
If you want to have $pic evaluated in other places than select
and test attributes of certain XSLT elements, you have to say so
explicitely. In your case, the magic is named "attribute value template"
or short AVT (google it), and it means that parts of attribute values
which are enclosed in braces are evaluated as XPath expressions.
More specifically, use
  <fo:external-graphic src="url(&quot;{$pic}&quot;)" ...
                                      ^    ^
Check your favorite XSLT book or online tutorial for details.

J.Pietschmann

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