[xml] Catalogs and relative paths



I'm currently trying to write a Python/XML-based website generation program 
using the libxml2/libxslt Python bindings; as part of this I need to do some 
sort of URL mapping for source documents, for instance converting 
http://wwwsource/foo to file:///home/smcv/websource/foo.xml. (This lets me 
use relative paths starting with / in a convenient way, without hard-coding 
my working directory into the site's source.)

The catalog mechanism seems like the mechanism I'm after, but relative paths 
don't seem to be treated in the way I'd expect; I'd like to check whether 
this is a bug or a feature before I start trying to fix it :-)

As a test case, I have the following document:

        <doc xmlns:xi="http://www.w3.org/2001/XInclude";>
        <txt>This is the correct test.xml.</txt>
        <xi:include href="include.xml"/>
        </doc>

I place this in rewrite/really-test.xml under my web server root, set up an 
XML catalog mapping from http://localhost/virtual/test.xml to 
http://localhost/rewrite/really-test.xml, and do
        xsltproc null.xslt http://localhost/virtual/test.xml
where null.xslt is a stylesheet that just prints out text nodes. As expected, 
this outputs "This is the correct test.xml". So far so good.

I then add --xinclude to the command line, hoping to get the text of 
http://localhost/virtual/include.xml. Instead, I get the text of 
http://localhost/rewrite/include.xml, i.e. the relative URI is looked up 
relative to the final location of the document, rather than relative to the 
location I first asked for.

Is this the intended behaviour of the base path when used with catalogs, or is 
this a bug?

[Please cc me on any replies, I'm not subscribed to the list.]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]