This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: import of website.xsl tries to connect tohttp://docbook.sourceforge.net/...


>>>>> "OF" == Fischer, Oliver <plexus@snafu.de> writes:

OF> Hello, I try to transform a XML document written with the
OF> website.dtd into HTML. Unfortunately the XSL file needs an
OF> external resource:

OF> xsltproc --catalogs -o index.html
OF> ../../../data/website/2.3/xsl/website.xsl index.xml

OF> xmlNanoHTTPConnectAttempt: Error connecting to remote host -
OF> Connection refusedxmlNanoHTTPConnectAttempt: Error connecting to
OF> remote host - Connection refusedwarning: failed to load external
OF> entity
OF> "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl";
OF> compilation error: file
OF> ../../../data/website/2.3/xsl/website-common.xsl line 20 element
OF> import xsl:import : unable to load
OF> http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
OF> *** Error code 5

OF> But I am not always at my office, so it can by that I don't have a
OF> internet connection. Is there a way to force it to use the local
OF> installation of these XSL files? Something similar to the CATALOG
OF> files for DTD resolution?

The xsltproc "--catalog" option is for *SGML* catalogs, which you can
use if you want:

Usage: xsltproc [options] stylesheet file [file ...]
   Options:
--catalogs : use SGML catalogs from $SGML_CATALOG_FILES
             otherwise XML Catalogs starting from 
         file:///etc/xml/catalog are activated by default

But for resolving the <xsl:import> URIs (which is the reason you get
the message), you need to use XML catalogs, documented here:

 http://www.oasis-open.org/committees/entity/spec-2001-08-06.html

(I'm pretty sure, but not 100% sure, that SGML catalogs don't work for
<xsl:import> with xsltproc).

All in all, XML catalogs are much superior to SGML catalogs.

As described in the xsltproc usage above, by default, the XML catalogs
in /etc/xml/catalog, is inspected first, I believe you can override
that location by setting the $XML_CATALOG_FILES environment variable.
In any case, add to /etc/xml/catalog (or whatever alternative location
you like), something like this:

<rewriteURI
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"; 
rewritePrefix="file:///path/to/the/top/level/of/your/docbook/">

This will mean that in the <xsl:import>:

http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl

will be translated to the relative path:

file:///path/to/the/top/level/of/your/docbook/html/docbook.xsl

PS. The other quick hack, which I don't recommend but if you need
something in a hurry, is to hack the path in the <xsl:import>
website.xsl to be a relative path to the main DocBook XSL
stylesheets.  Try the XML catalog way first, it's better for you in
the long run because you can write portable documents and stylesheet
customization layers.

A.
-- 
  Alex Lancaster | Free Software Developer:  savannah.gnu.org, sourceforge.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]