Hi all. I'm trying to narrow down a problem that leads to very
different results in lxml vs. xsltproc.
If this line is present in my stylesheet:
<xsl:apply-templates select="exslt:node-set($contentmap)/
dv:contentmap/dv:topics/dv:topic"/>
...then unusual things happen in the result of lxml, vs. the result
of xsltproc. I have the xmlns for exslt set in the stylesheet. To
make a test case, imagine we have:
exsl-test.xml
-----------------------
<?xml version="1.0" …
[View More]encoding="UTF-8"?>
<doc/>
exsl-test.xsl
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:exslt="http://exslt.org/common">
<xsl:variable name="map">
<map>
<item id="1"/>
<item id="2"/>
</map>
</xsl:variable>
<xsl:template match="/">
Output
<xsl:for-each select="exslt:node-set($map)/map/item">
id is: <xsl:value-of select="@id"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
exsl-test.py
-----------------------
import lxml.etree
xmldocf = open("exsl-test.xml", "r")
xmldoc = lxml.etree.parse(xmldocf)
xsldocf = open("exsl-test.xsl", "r")
xsldoc = lxml.etree.parse(xsldocf)
xsl = lxml.etree.XSLT(xsldoc)
r = xsl.apply(xmldoc)
print xsl.tostring(r).encode("utf-8")
The output from xsltproc is:
paul$ xsltproc exsl-test.xsl exsl-test.xml
<?xml version="1.0"?>
Output
id is: 1
id is: 2
However, the output from lxml is:
paul$ python ./exsl-test.py
<?xml version="1.0"?>
Output
Thus, I'm led to conclude that lxml needs something to turn on built-
in extension functions, something that the xsltproc binary has by
default.
--Paul
[View Less]
Le 16 avr. 2005, à 09:52, Paul Everitt a écrit :
>
> Hmm, your etree.so seemed to work!
>
> Attached is mine.
>
> --Paul
Well, I'll be....
Your etree.so passes all tests on my machine (in either 2.3 or 2.4,
which really makes no sense.)
(Yes, I am loading the right one. Checked with gdb.)
I am beginning to suspect that the problem lies with the DarwinPorts
Python... or libxml, or something.
BTW, 10.3.9 now includes a nice version of libxml and libxslt. You
could try …
[View More]building against those?
Marc-Antoine
[View Less]