Until the FOPSerializer is fixed up to allow a base url for images, you can
use an XSL stylesheet instead. When I started with FOP I used absolute URLs
too, until I wrote this simple stylesheet called
("set-external-graphic-src-base-url.xsl"). The code is simple; it assumes
all URLs are relative, and it modifies all "src" attributes, but it should
do the job.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version='1.0'>

        <xsl:param name="base-url"/>

        <xsl:template match="@*|node()">
                <xsl:copy>
                        <xsl:apply-templates select="@*|node()"/>
                </xsl:copy>
        </xsl:template>

        <xsl:template match="@src">
                <xsl:attribute name="src"><xsl:value-of
select="$base-url"/><xsl:value-of select="."/></xsl:attribute>
        </xsl:template>

</xsl:stylesheet>

In your sitemap, call this stylesheet with a parameter before serializing,
like this:

<map:match pattern="*.pdf">
        <map:generate src="{1}.fo"/>
        <map:transform src="set-external-graphic-src-base-url.xsl">
                <!-- add base url (note the trailing / in the url) -->
                <map:parameter name="base-url"
value="http://127.0.0.1/images/"/>
        </map:transform>
        <map:serialize type="fo2pdf"/>
</map:match>

Regards

Conal

> -----Original Message-----
> From: Torsten Curdt [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 22 March 2002 00:44
> To: Cocoon Users; Nicola Ken Barozzi
> Subject: Re: External graphic, FOP and URIResolver
> 
> 
> On Thu, 21 Mar 2002, Nicola Ken Barozzi wrote:
> 
> > From: "Torsten Curdt" <[EMAIL PROTECTED]>
> >
> > > > Is it possible that FOP uses the URIResolver of Cocoon 
> instead, in order
> > to
> > > > understand pseudo-protocol (especially cocoon:// and 
> resource://) ?
> > > >
> > > > Is there a trick in order to use relative paths in FOP? 
> (I read the
> > > > archives and everyone
> > > > seems to use full URLs :-(
> > >
> > > IIRC there is a static configuration in FOP where you can 
> specify a
> > > context directory. Unfortunately this not yet configurable in the
> > serializer and
> > > since it's static it will be for each FOP tasks...
> > >
> > > Maybe you can post this issue on the FOP list and help 
> make this better
> > > configurable...
> >
> > FOP community is in the process of making this happen, by 
> using Avalon
> > Configuration.
> > If you want to partecipate, goto [EMAIL PROTECTED] .
> 
> great news :)
> --
> Torsten
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
> 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to