[lxml-dev] XML Catalogs
Hello. I'd like to use catalogs to locate XSL stylesheets the way it is done in this document: http://www.sagehill.net/docbookxsl/WriteCatalog.html I'm not sure it is possible to do this with lxml, and how I could achieve this. The only information I found on using catalogs is the use of external_id etree.DTD: http://codespeak.net/lxml/validation.html Does anyone has the answer? -- David
dsoulayrol@free.fr, 06.12.2009 11:28:
I'd like to use catalogs to locate XSL stylesheets the way it is done in this document:
lxml's catalog support is based on libxml2: http://xmlsoft.org/catalog.html Is anything not working for you regarding catalogs? Stefan
On Sun, Dec 06, 2009 at 12:02:36PM +0100, Stefan Behnel wrote:
lxml's catalog support is based on libxml2:
http://xmlsoft.org/catalog.html
Is anything not working for you regarding catalogs?
Actually nothing at the moment. My problem is I don't understand how I can achieve what I want with the documentation I have. All I found in lxml documentation is how to resolve a DTD Public ID from the catalog: dtd = etree.DTD(external_id = "-//OASIS//DTD DocBook XML V4.2//EN") What I want is to get an URL from a xsl sheet name using a <uri /> entry in my catalog: <catalog> <uri name="my_sheet.xsl" uri="file:///usr/local/share/xml/my_sheets/sheet1.xsl"/> </catalog> I may be wrong, but I didn't find any help for this in the parsing or XSLT subjects of the documentation. I think I've understood xmlsoft doc as well, but it didn't help in this matter. Sorry if it is a silly question, but I'm in the dark there. -- David
David Soulayrol, 06.12.2009 17:04:
On Sun, Dec 06, 2009 at 12:02:36PM +0100, Stefan Behnel wrote:
lxml's catalog support is based on libxml2:
http://xmlsoft.org/catalog.html
Is anything not working for you regarding catalogs?
Actually nothing at the moment. My problem is I don't understand how I can achieve what I want with the documentation I have. All I found in lxml documentation is how to resolve a DTD Public ID from the catalog:
dtd = etree.DTD(external_id = "-//OASIS//DTD DocBook XML V4.2//EN")
What I want is to get an URL from a xsl sheet name using a <uri /> entry in my catalog:
<catalog> <uri name="my_sheet.xsl" uri="file:///usr/local/share/xml/my_sheets/sheet1.xsl"/> </catalog>
Ah, ok, there isn't currently any API for that in lxml. Catalog support is mostly used for loading DTDs etc., so that's what's supported behind the scenes. Explicit lookups in a catalog would happen through a call to xmlCatalogResolveURI() in libxml2: http://xmlsoft.org/html/libxml-catalog.html#xmlCatalogResolveURI but that would require wrapping catalog.h first. Stefan
participants (3)
-
David Soulayrol -
dsoulayrol@free.fr -
Stefan Behnel