Note that there are some explanatory texts on larger screens.

plurals
  1. POPython LXML catalog lookup
    primarykey
    data
    text
    <p>I'm making an SCons file for building Docbook documentation. In order to trace dependencies I would like some way to resolve catalog file lookups to an absolute path to a file.</p> <p>So say I have a bit of Docbook XML : </p> <pre><code>&lt;book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"&gt; &lt;info&gt; &lt;title&gt;Docbook example document&lt;/title&gt; &lt;xi:include href="file:///common/logo.xml" xpointer="logo"/&gt; &lt;/info&gt; &lt;xi:include href="chap1/chap1.xml"/&gt; &lt;xi:include href="chap2/chap2.xml"/&gt; &lt;xi:include href="chap3/chap3.xml"/&gt; &lt;xi:include href="chap4/chap4.xml"/&gt; &lt;/book&gt; </code></pre> <p>and a catalog.xml file :</p> <pre><code>&lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt; &lt;rewriteURI uriStartString="file:///stylesheet/" rewritePrefix="file:///home/kst/svn/TOOLS/Docbook/stylesheet/" /&gt; &lt;rewriteURI uriStartString="file:///common/" rewritePrefix="file:///home/kst/svn/TOOLS/Docbook/common/" /&gt; &lt;nextCatalog catalog="/etc/xml/catalog" /&gt; &lt;/catalog&gt; </code></pre> <p>Getting the xinclude href string is no problem using lxml but I'm stuck there. What I need is some way to get the absolute filename that file:///common/logo.xml resolves to (in this case /home/kst/svn/TOOLS/Docbook/common/logo.xml) from the catalog file. It needs to be some kind of Python code so I can use it in my SConstruct file without too much hassle. </p> <p>Any help is appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload