[xsl] Catalog file to use local version of dtd

Subject: [xsl] Catalog file to use local version of dtd
From: Mark <charltonrainbird@xxxxxxxxxxxxxx>
Date: Mon, 17 Nov 2008 18:33:57 +0000
Hi

I'm using Saxon 9.0.0.6J to process xslt 2 stylesheets from the command line.

I've got a set of xml files that have the following dtd DOCTYPE element:

<!DOCTYPE exp-level-1 SYSTEM "file://nastntx95001/group-xml.dtd">

If I edit the files to read:

<!DOCTYPE exp-level-1 SYSTEM "group-xml.dtd">

everything works fine but as I need to do this for frequent updates
over multiple files I'd rather just switch to a local version of the
dtd without having to edit all the files everytime. All my research
here and on the web in general tells me I need to use a catalog file
to do this. However, whatever I try fails and I'm still not sure if
this is a problem with the way I'm approaching this or a command line
syntax error.

I've created catalog.xml which consists of:

<?xml version="1.0" encoding="UTF-8"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <system systemid="file://nastntx95001/group-xml.dtd"
uri="file://D:/Content/MTG/xml/group-xml.dtd"/>
</catalog>

I then run this from the command line using (character > inserted to
aid readability):

<!-- EXISTING COMMAND LINE -->
java -Xms512m -Xmx512m -DentityExpansionLimit=100000 >

<!-- ADDITION TO COMMAND LINE -->
-Dxml.catalog.files=D:\Content\MTG\xml\catalog.xml -Dxml.catalog.verbosity=1

<!-- EXISTING COMMAND LINE -->
net.sf.saxon.Transform >

<!-- ADDITION TO COMMAND LINE -->
-r org.apache.xml.resolver.tools.CatalogResolver >
-x org.apache.xml.resolver.tools.ResolvingXMLReader >
-y org.apache.xml.resolver.tools.ResolvingXMLReader

<!-- EXISTING COMMAND LINE -->
>-o D:\Content\MTG\html\mtg_00.htm D:\Content\MTG\xml\mtg.xml mtg.xsl mak_ID=mtg path=D:\Content\MTG\html\ name_title="Master Tax Guide"

I'm not using -cp as I've got classpaths already set for:

c:\programs\saxon\saxon9.jar;c:\programs\saxon\resolver.jar

having copied the XML Commons Resolver from Apache site as per Florent
Georges blog on "XML Catalogs support in Saxon 8 for Java"
(http://fgeorges.blogspot.com/). jar file and associated folders etc
are in this location.

I get the error:

Recoverable error on line 57 of file:/D:/Content/MTG/mtg.xsl:
  FODC0005: java.net.UnknownHostException: nastntx95001

for everytime the document() function trys to access one of these
files. Files with the edited dtd DOCTYPE element run fine. I get the
same error whether I leave my new command line instructions in or not.
I've tried setting a fake http address in place of a fixed file
location and all other kinds of tweaks but to no avail.

Can anybody spot where I'm going wrong?

Thanks for any assistance.

Mark

Current Thread