[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[xml] Fwd: continued problem with Python, libxml2 and entities
- From: Mike Kneller <ukchill mac com>
- To: xml gnome org
- Subject: [xml] Fwd: continued problem with Python, libxml2 and entities
- Date: Mon, 29 Jan 2007 06:28:59 -0800
It turns out that the same transform run through xsltproc gives the correct result.
What I am expecting to see is:
<?xml version="1.0"?>
<content>
<p>©2007</p>
</content>
When I run it using test.py, the result I get is:
<?xml version="1.0"?>
<content>
<p>2007</p>
</content>
So, as the xsltproc version gives me the correct result, I guess I can eliminate the library as the source of the problem, instead it would appear to be a problem with my Python code, or the Python wrapper.
Any ideas?
Mike
>From: "Mike Kneller" <ukchill mac com>
>To: <xml gnome org>
>Date: January 28, 2007 09:26:40 AM PST
>Subject: [xml] continued problem with Python, libxml2 and entities
>
>The continuing saga!
>
>I seem to have moved the entity issue from libxml2 to libxslt...
>
>Using the following testcase (using a standard identity
>transformation) now loses the entity.
>
>replacing <xsl:copy> with <xsl:copy-of> on the <p> node produces
>output with the entity, as does using <xsl:value-of> on the same node.
>
>===test.py===
>import libxml2
>import libxslt
>
>sourcedoc = libxml2.parseFile( 'test.xml' )
>styledoc = libxml2.parseFile( 'test.xsl' )
>style = libxslt.parseStylesheetDoc(styledoc)
>result = style.applyStylesheet(sourcedoc, None)
>print style.saveResultToString( result )
>style.freeStylesheet()
>result.freeDoc()
>sourcedoc.freeDoc()
>
>
>===test.xml===
><?xml version="1.0"?>
><?xml-stylesheet type="text/xsl" href="test.xsl" ?>
>
><!DOCTYPE content [
> <!ENTITY copy "©">
>]>
>
><content>
> <p>©2007</p>
></content>
>
>
>===test.xsl===
><?xml version="1.0"?>
><xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
><xsl:template match="/">
> <xsl:apply-templates match="." />
></xsl:template>
>
><xsl:template match="@*|node()">
> <xsl:copy>
> <xsl:apply-templates select="@*|node()"/>
> </xsl:copy>
></xsl:template>
>
></xsl:stylesheet>
>
>
>Cheers
>Mike Kneller
>ukchill mac com
>http://www.mikekneller.com
>
>_______________________________________________
>xml mailing list, project page http://xmlsoft.org/
>xml gnome org
>http://mail.gnome.org/mailman/listinfo/xml
>
>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]