Monday, May 14, 2007

XML Catalogs support in Saxon 8 for Java

Saxon doesn't support OASIS's XML Catalogs natively. But adding this support yourself is quite easy. You need the XML Commons Resolver from Apache. Make sure the JAR resolver.jar you will find in the archive is in you classpath. Then you need to call Saxon with the following options:

java -cp <saxon and resolver jars> \
    -Dxml.catalog.files=<the catalog files> \
    -Dxml.catalog.verbosity=1 \
    net.sf.saxon.Transform \
    -r \
    -x \
    -y \
    <other options>

That's it!

You can also use my shell script to launch Saxon, that supports catalogs through additional options (see the script page or this post):

saxon --catalogs=<the catalog files> <other options>

Labels: ,


Post a Comment

<< Home