[lxml-dev] Using EXSLT extensions on Windows with standard lxml binaries
Stefan Behnel
stefan_ml at behnel.de
Wed Feb 27 07:59:13 CET 2008
Hi,
Alexander Kozlovsky wrote:
> I'm trying to use EXSLT extension functions on Windows
> with standard lxml binary distribution (lxml-1.3.6.win32-py2.4.exe)
>
> I'm trying to do the next, but it is not work as expected:
>
> <?xml version="1.0"?>
> <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
> xmlns:str="http://exslt.org/strings" extension-element-prefixes="str">
>
> <xsl:template match="body">
> <body>
> <h1 class="{str:replace('abc', 'b', 'x')}">test</h1>
> </body>
> </xsl:template>
>
> </xsl:stylesheet>
This definitely works for me on Linux:
------------------------------
def test_exslt_str_attribute_replace(self):
tree = self.parse('<a><b>B</b><c>C</c></a>')
style = self.parse('''\
<xsl:stylesheet version = "1.0"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str">
<xsl:template match="/">
<h1 class="{str:replace('abc', 'b', 'X')}">test</h1>
</xsl:template>
</xsl:stylesheet>''')
st = etree.XSLT(style)
res = st(tree)
self.assertEquals('''\
<?xml version="1.0"?>\n<h1 class="aXc">test</h1>\n''',
str(res))
------------------------------
May be a problem with the Windows build?
Stefan
More information about the lxml-dev
mailing list