RE: [xsl] Saxon and XML Catalogs

Subject: RE: [xsl] Saxon and XML Catalogs
From: David.Pawson@xxxxxxxxxxx
Date: Wed, 2 Jul 2003 08:30:53 +0100
> We are trying to use XML Catalogs with Saxon Apache . 

I'm guessing you mean Saxon? Its not part of Apache.

 Saxon is 
> initially resolving the catalog file, when it loads the XML
> file it doesn't resolve the DTD.  It keeps looking in the source
> directory for the DTD.

Without a steer, saxon looks in the same directory as the
stylesheet I think. Hence the need for the base command.
If you make it absolute it works more easily

<group xml:base="file://c:/sgml/files/">




> 
> We have tried public identifiers, system identifiers and URIs
> in the XML file and get the same results.

If you want to avoid increasing versions in the dtd names,
try

<catalog prefer="public"
	 xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">

which makes the resolver hit on the fpi before the SYSTEM bit.


> java -classpath "%CLASSPATH%" com.icl.saxon.StyleSheet -w0 -x 
> org.apache.xml.resolver.tools.ResolvingXMLReader -y 
> org.apache.xml.resolver.tools.ResolvingXMLReader -r 
> org.apache.xml.resolver.tools.CatalogResolver  raven.xml 
> lib/poem.xsl  

Sounds about right. I use

java  -cp
.;\sgml;\myjava\saxon652.jar;\myjava\xerces.jar;\myjava\cat\resolver.jar;\sg
ml\nw\docbook\website-2.2\extensions\saxon64.jar
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBu
ilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactory
Impl
-Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImp
l  com.icl.saxon.StyleSheet   -o %3  -x
com.sun.resolver.tools.ResolvingXMLReader -y
com.sun.resolver.tools.ResolvingXMLReader -r
com.sun.resolver.tools.CatalogResolver -w1 %1  %2 "saxon.extensions=1"  %4
%5 %6

just to make sure I get a decent parser too.

> 
> <-- Catalog File -->
>  
> <?xml version="1.0"?>
> <!DOCTYPE catalog
>    PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
>    
> "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>

Once you are familiar with the catalog format,
I'd dump the document type declaration. Only slows things down.


> 
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
Your choice, but I'd add the prefer="public"



> 
>   <group  xml:base="'/TestCatalog/" >
Why double quoted?
<group xml:base="file://c:/sgml/files/">
works for me. Try the missing file://


> 
>       <public publicID="-//Test//DTD //EN" 
> uri="file:///c:/TestCatalog/DTD/poem.dtd"/>

> <rewriteURI
>         uriStartString="foo.dtd"
>         rewritePrefix="DTD/poem.dtd" />

Mmm. I've never used/needed the rewrite. Can't help you there.
I do use
<uri name="http://www.loc.gov/nls/z3986/v100/ncx110.dtd";
   uri="/sgml/niso/ncx110.dtd"/>

To map from a web based to a local dtd.


Snip


> Parse catalog: file:/TestCatalog/catalog/poem.soc
> Loading catalog: file:/TestCatalog/catalog/poem.soc
> Default BASE: file:/TestCatalog/catalog/poem.soc
> xml:base: '/TestCatalog/
> BASE STR: '/TestCatalog/
> Error: required attribute publicId missing.
> rewriteURI: foo.dtd
> 	DTD/poem.dtd
> REWRITE_URI: foo.dtd

something wrong here. Try the form above.
<rewriteSystem systemIdStartString="http://www.oasis-open.org/";
          rewritePrefix="file:///share/doctypes/oasis/"/>
is the definition.


> 	file:/TestCatalog/catalog/'/TestCatalog/DTD/poem.dtd (reset)
> xml:base: file:/TestCatalog/catalog/poem.soc BASE STR:
> file:/TestCatalog/catalog/poem.soc
> resolveSystem(file:/C:/TestCatalog/lib/poem.xsl)

Looks like the xml:base is working nicely.

Failing on the re-write?

Probably teaching grandma about eggs and all that...

http://wwws.sun.com/software/xml/developers/resolver/article/#d0e719

The bible:
http://www.oasis-open.org/committees/download.php/130/cs-entity-xml-catalogs
-1.0.html#s.rewritesystem

Note the broken uri.

HTH DaveP.


*** snip here ***

- 

NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 
system.

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread