Re: [xslt] How to make python bindings fetch entities?

On Tue, Aug 26, 2003 at 10:42:34PM +0200, Řyvind Hvamstad wrote:
> Hi, my first post at this list.
> I'm trying to get external entities from other files using the python
> bindings for libxml2 and libxslt. The parser seems to recognize them,
> but no xml is fetched. No errors are reported. So my question is how to
> do this. My code is like this:
> import libxml2, libxslt
> libxml2.lineNumbersDefault(1)
> libxml2.substituteEntitiesDefault(1)
> xmlLoadExtDtdDefaultValue = 1
> styledoc = libxml2.parseFile("xsl/index.xsl")
> style = libxslt.parseStylesheetDoc(styledoc)
> doc = libxml2.parseFile("index.xml")
> result = style.applyStylesheet(doc, None)
> stringval = style.saveResultToString(result)
> style.freeStylesheet()
> doc.freeDoc()
> result.freeDoc()
> print stringval
> I could not make the pyxsltproc do it either, hope someone can help

  I don't understand your problem. If xsl/index.xsl or index.xml reference
entities they will be fetched and incorporated into the styledoc and
doc. There is nothing in your code which could prove the opposite, your
report is clearly incomplete. That should just work.


Daniel Veillard      | Red Hat Network  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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