[lxml-dev] NotImplementedError for external functions with xsl:variable's

Dmitri Fedoruk dfedoruk at gmail.com
Wed Oct 29 12:09:43 CET 2008


Greetings,

We've been using lxml for almost a year now. Recently we were stuck with 
XSLT functionality and eventually started to use external functions, 
which are pretty useful in many cases. Of course, this makes the 
template unportable, but we deal with this.

So, we register the functions in our namespace for the transformer and 
use them like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:fe="http://rambler.ru/fe"
                  extension-element-prefixes="fe">
<xsl:template match="/">
	query=<xsl:value-of select="fe:quote($query)"/>
</xsl:tempalte>

Here $query is the external parameter passed to the transformer. Works fine.

But when we slightly modify the template and want to use not the 
external parameter, but xsl:variable, we fail:

<xsl:template match="/">
   <xsl:variable name="query1">asdfadsfadsf</xsl:variable>
   query=<xsl:value-of select="fe:quote($query1)"/>
</xsl:tempalte>

We have lxml 2.0.1 in production and 2.1 on the development machine. The 
problem occurs, but in slightly different manner, in both situations. 
2.0.1 just performs nothing and returns an empty string; 2.1 raises
   File "xslt.pxi", line 515, in lxml.etree.XSLT.__call__ 
(src/lxml/lxml.etree.c:90526)
   File "lxml.etree.pyx", line 233, in 
lxml.etree._ExceptionContext._raise_if_stored (src/lxml/lxml.etree.c:4916)
   File "extensions.pxi", line 665, in 
lxml.etree._extension_function_call (src/lxml/lxml.etree.c:82995)
   File "extensions.pxi", line 513, in lxml.etree._unwrapXPathObject 
(src/lxml/lxml.etree.c:81828)
NotImplementedError

As far as I can understand, this situation is handled explicitly in 2.1 
and there are reasons for that. So, may I ask if it is implemented 
sometime later?

Cheers,
Dmitri


More information about the lxml-dev mailing list