cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stevens" <>
Subject Re: PDF: external-graphic & absolute pat
Date Fri, 21 Jul 2006 10:32:55 GMT
>From: "Omar Adobati" <>
>Date: Fri, 21 Jul 2006 12:03:05 +0200
>> > I worked around that by passing in the host/port/context (read from the
>> > request object) as a parameter to the XSL transformation.  You could do
>> > the same with Cocoon using something like
>> > <map:transform type="xsl" src="whatever.xsl">
>> >    <map:parameter name="baseUrl"
>> >
>> > in your sitemap and
>> > <xsl:param name="baseUrl"/>
>> > ...
>> > <fo:external-graphic
>> > in the XSLT stylesheet.  This avoids having to hard code the server in
>> > XSL.
>I tried to do this into my sitemap.xmap
>    <map:match pattern="*.jpg">
>      <map:parameter name="baseUrl"
>      <map:read mime-type="image/jpg" src="img/{1}.jpg"/>
>    </map:match>

Wrong place.  The baseUrl is to be passed into the XSL transformation, the 
reader that's returning the bitmap doesn't need to know it.  And besides, 
even if you had a reader that e.g. embedded the URL in an EXIF field in the 
JPEG, you'd have to put the parameter inside the <map:read> element rather 
than inside the <map:match>.  You'd only need it there if the wildcard URI 
matcher were written to expect a parameter of that name.

>>and I tried to put it also here:
><map:match pattern="*.html">
>   	  <map:generate src="xml/{1}.xml"/>
>	  <map:transform src="xsl/xml2html.xsl"/>
>	  <map:serialize type="html"/>
>	</map:match>

You need to use
	  <map:transform src="xsl/xml2html.xsl">
	      <map:parameter name="baseUrl" 
and the transformer will then pass the parameter to the XSL transformation 
engine, which will allow you to access it within xml2html.xsl using a 
top-level (at the start, outside any xsl:template) <xsl:param 
name="baseUrl"/> element.  Then, when you output the external-graphic 
elements, use <fo:external-graphic src="{$baseUrl}/whatever.jpg"/>

>but seems that baseUrl is a blank string... so it doesn't work for me...
>could you suggest me why?
>IT could depends by the fact that I'm actually running cocoon in Tomcat?

The container shouldn't matter, I've used this technique running in Tomcat 
on my own machine, then deployed the same war to Websphere.  It worked the 
same in both.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message