cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gianugo Rabellino" <gian...@rabellino.it>
Subject Re: fop and images on relative paths
Date Sat, 29 Sep 2001 13:53:35 GMT


> Is there a way to make fop to include images described
> by relative path e.g.:
> <fo:external-graphic src="img/path.jpg" ...

Not really, and almost on purpose. I ran into the same problem when writing
the RTF serizalizer and found out that Serializers don't know anything about
the context, which includes the various path informations.

Actually, however, even if has been done on purpose (I understand that it
has to do with caching), this can be seen as a "feature": Cocoon strongly
decouples the physical sources and the virtual URI they are mapped to. This
means that it's ankward, to say the least, to understand what should be
considered the starting point to be used for relative paths.

Suppose you have the following situation: your sitemap matches
/mysite/docs/printer/document.pdf, which resolves in a generation using
/mysite/sources/document.xml and a trasformation using
/mysite/xslt/fo/document.xsl. How should a URI such as "../img/myimg.gif" be
resolved? You have three options:

1. URI mapping: the image resides in /mysite/docs/img/mysite.gif;
2. Source mapping: this resolves in /mysite/img/mysite.gif;
3. Transformation mapping: finally here it would be
/mysite/xslt/img/myimg.gif.

There is no particular reason to prefer one over the other: the solution,
unfortunately, is to stick to absolute link. I'm thinking about writing a
sort of LinkAbsolutizerTransformer which takes the "src" and "href"
attributes, sees if they are relative and acts accordingly setting them to
an absolute value. But I'm not quite sure this would be a good solution.

Meanwhile, absolute links are the way to go.

Ciao,

--
Gianugo Rabellino


---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message