atom feed7 messages in org.apache.xmlgraphics.fop-usersRe: Location of external graphics
FromSent OnAttachments
John BrownAug 7, 2008 9:43 am 
Pete AllisonAug 7, 2008 10:16 am 
Jeremias MaerkiAug 7, 2008 11:06 am 
Jeremias MaerkiAug 7, 2008 11:16 am 
Jeremias MaerkiAug 7, 2008 11:29 am 
Pete AllisonAug 7, 2008 11:36 am 
John BrownAug 7, 2008 12:14 pm 
Subject:Re: Location of external graphics
From:Jeremias Maerki (
Date:Aug 7, 2008 11:16:28 am

Bundling the stylesheets in the WAR file is one solution that many users seem to be using. Another could be using a XML Catalog (using XML Commons Resolver from the Apache XML project). More information on the resolver here:

With an XML Catalog you could do things like rewriting URIs like: myresources:xslt/mystylesheet.xslt to: file:/home/user/resources/xslt/mystylesheet.xslt

The XML Commons Resolver implements both the EntityResolver and URIResolver interfaces. In FOP, you can configure your own URIResolver. However, the Java example on the Wiki page above (as I had to notice now) is hopelessly outdated. I'll see to it that it is updated.

Yet another way is to just set the base URI on the FopFactory to something you define. But then you're still using relative filenames. Not that this is bad in any way. But it can be hard to debug.


On 07.08.2008 19:16:18 Pete Allison wrote:

This may not be the appropriate forum (may be more of a Java question), so I asked for your forbearance.

We are struggling with where to keep our image files. Right now we loading them with absolute file paths. This works for one application that "builds" the path based on environment information. This allows us to maintain portability.

We have another application that does not know anything about its environment. When the application is moved from a development server to a production, we must update the stylesheet to reflect the server change. We would like to avoid this.

It appears that file references, if not absolute, are relative to the (and here's the part we are a little fuzzy on) the classpath for our FOP servlet?

If this is the case, I guess we can put them in the WAR file and then redistribute it as needed. I was hoping for a cleaner solution.