[lxml-dev] NotImplementedError for external functions with xsl:variable's
Stefan Behnel
stefan_ml at behnel.de
Sun Nov 9 16:38:27 CET 2008
Hi Dmitri,
Dmitri Fedoruk wrote:
> 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 "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
I was right in recalling that I had started working on this before, but
according to the partial patch in my working directory, I never got around to
finishing it up. I assume that your real stylesheet creates a result tree
fragment for the variable that you pass into your function. Until now, lxml
didn't handle result trees at all. I'm not exactly sure what a result tree
fragment looks like in libxslt in all possible cases, but what I implemented
on the trunk so far works for me. Please give it a try (after installing
Cython 0.10).
It would be nice if you could come up with a couple of additional test cases
for test_xslt.py to make sure this works (and continues to work) as expected
for different variable values or <xsl:copy-of> scenarios. Currently, there is
only test_variable_result_tree_fragment(), which tests for result trees
returned by <xsl:apply-templates/>.
Have fun,
Stefan
More information about the lxml-dev
mailing list