[lxml-dev] lxml extensions (fwd)

Stefan Behnel stefan_ml at behnel.de
Mon Feb 19 19:41:41 CET 2007


Hi,

Dennis Allison wrote:
> The XSLT processing follows the published pattern
> 
>    # python extension function
>    def func(dummy):
>    	return 'some result'
>
>    # namespace setup
>    ns = etree.FunctionNamespace('http://mydomain.com/functions')
>    ns['func'] = func
>    ns.prefix = 'nf'
[...]
> My test XSLT file contains an XPath expression of the form 
> 
> <xsl:value-of select="nf:p()" />

You are calling a function called "p" here, however, in the namespace, you
have declared your function under the name "func". While lxml is pretty
sophisticated, it is not as intelligent as your code requires. ;)

Stefan


More information about the lxml-dev mailing list