[lxml-dev] Is exslt wired in by default?
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" 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
participants (1)
-
Paul Everitt