This page describes how to use the XML Commons Resolver with Apache FOP. It shows you how you can use abstract URIs to specify resources such as images and how you can translate these abstract URIs to actual URLs pointing to the real file. This is ideal to do a mapping for resources for which the final location at deployment time is not known. The catalog file is where you specify how the URIs are supposed to be mapped to the concrete URLs.

Note: This requires Apache FOP 0.93 or later!

Get XML Commons Resolver

You can download it at:

The main website is at:

XML Commons Resolver is [ included in OpenJDK 6], so if you're running OpenJDK 6 or later, it's already installed. In OpenJDK 6 the catalog resolver class name is,

XML Commons Resolver may also be included in Java 6 installations other than the one from Sun - this should be checked.

The Example

You can download the source for the example from the web using the following links:

Setup instructions

     -Dxml.catalog.files="C:/Dev/Java/workspace/FOP Main Sandbox/src/xml/fop-demo-catalog.xml"

(Obviously, you will need to adjust the path. You simply need to make sure that the path is right and the catalog file is found.


You will recognize that the FO file is specified through a "URN", too, not just the image referenced in the FO file. This is simply to make it easier for you to set up the demo. The FO file itself will be loaded directly from the Web.

Command line option

Simon Pepping [ added a -catalog option] in [ revision 825875]. With this option you can render XML with the FOP command and use the catalog resolver:

  $ ./fop -catalog -xml icaatom.html -xsl icaatom.xsl icaatom.pdf

The -catalog option specifically only works for the conversion from XML to output. (In such a case FOP sets up the transformation from XML to FO using XSLT, and in that setup the -catalog option adds a catalog resolver.) Even with the -catalog option the catalog resolver is not used for image retrieval. (Maybe it should, but it has not been thought of.)

Since the W3C started [ blocking abusive request patterns] for DTDs, it may be necessary to use local copies of these DTDs instead. A good way to do this is with the catalog resolver. Errors like the following may happen when you try using a DTD from the W3C's servers: Server returned HTTP response code: 503 for URL:

HowTo/XmlCommonsResolver (last edited 2009-12-04 23:37:07 by S010600226b5eab8e)