[lxml-dev] etree.XSLTApplyError: xsltValueOf: text copy failed (Custom XSLT function usage error)

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Wed Nov 15 08:58:17 CET 2006


Hi,

Chas Emerick wrote:
> One of the key features of lxml from our perspective is the stated  
> availability of custom function bindings within xslt.  However, we've  
> run into some difficulty in implementing them.  Here's a concise  
> example.
> 
> First, we set up our custom function, nothing special:
> 
>  >>> from lxml import etree as ET
>  >>> ns = ET.FunctionNamespace(None)
>  >>> ns['testfunction'] = lambda dummy, *args: 'function args: %s' %  
> str(args)


You should generally avoid using empty namespaces for functions. It's not a
big deal to use a local fake namespace here, but it prevents you from running
into a number of difficult to track down problems.

Could you retry with an explicit namespace and report back if that also fails?

Stefan



More information about the lxml-dev mailing list