using saxon9he with catalog.xml file

2019-08-09 01:48发布

my catalog.xml

<?xml version="1.0"?>
<catalog  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> 

    <public 
       publicId="-//EG//DTD EG DITA Map//EN" 
       uri="dtds/maps.dtd"/>
    <public 
       publicId="-//EG //DTD EG DITA Composite//EN" 
       uri="dtds/topics.dtd"/>

</catalog>

the DTDs as they are expected:

<!DOCTYPE concept PUBLIC "-//EG//DTD EG DITA Composite//EN" "../../system/dtd/client/eg-dita.dtd">

<!DOCTYPE docmap PUBLIC "-//EG//DTD EG DITA Map//EN" "../../system/dtd/client/eg-docmap.dtd">

the filestore layout (windows 7):

    F:\export\catalog.xml
    F:\export\*.xsl
    F:\export\saxon9he.jar
    F:\export\resolver.jar
    F:\export\dtds\maps.dtd
    F:\export\dtds\topics.dtd
    F:\export\test\*.xml
    F:\export\test\folders\*.xml

Console output:

Loading catalog: \catalog.xml
Saxon-HE 9.6.0.4J from Saxonica
Java version 1.7.0_09
Stylesheet compilation time: 940.807978ms
Processing file:/F:/export/folders.xml
Using parser org.apache.xml.resolver.tools.ResolvingXMLReader
Building tree for file:/F:/export/folders.xml using class
net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 3.841258ms
Tree size: 6 nodes, 0 characters, 6 attributes
Building tree for file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map using class net.sf.saxon.tree.tiny.TinyBuilder
Error at template on line 33 of maps.xsl:
  I/O error reported by XML parser processing
  file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map: F:\export\system\dtd\client\eg-docmap.dtd (cannot find path)
I/O error reported by XML parser processing file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map: F:\export\system\dtd\client\
eg-docmap.dtd (cannot find path)

So the file F:/export/test/532a1069faf343d79c4ad37f8339aeda.ditamap has the DTD <!DOCTYPE docmap PUBLIC "-//EG//DTD EG DITA Map//EN" "../../system/dtd/client/eg-docmap.dtd"> and expects its DTD to be at F:\export\system\dtd\client\eg-docmap.dtd And I want to make the parser look at F:\export\dtds\maps.dtd

EDIT:

This is how I call it:

java -cp "saxon9he.jar;resolver.jar" net.sf.saxon.Transform base.xml all_maps.xsl -t -catalog:"catalog.xml"> all_maps.xml

And in the output, it says this now (I didnt have the -t option before):

Resolved public: -//EG //DTD EG DITA Map//EN
        file:/F:/export/dtds/maps.dtd
Failed to create InputSource (java.io.FileNotFoundException: F:\export\dtds\maps.dtd (system cand file the file)): file:/F:export/dtds/maps.dtd

标签: xml xslt saxon
1条回答
甜甜的少女心
2楼-- · 2019-08-09 02:16

Well, it should have worked. I didnt see that windows had added an extra .txt to the file names. After removing that, it worked like a charm.

Command-line as shown in the questions, catalog file as shown in the question.

查看更多
登录 后发表回答