[lxml-dev] How to access XSLT Parameters Inside an Extension Function?

Thomas Schraitle tom_schr at web.de
Tue Jun 10 21:35:08 CEST 2008


Hi,

On Dienstag, 10. Juni 2008, Stefan Behnel wrote:
> [...]
>
> What about this (totally untested) code snippet:
>
>     class DocBoocXSLT(XSLT):
>         def __init__(self, xslt_input):
>             extensions = {("ns", "myfunc1") : self.myfunc1}
>             XSLT.__init__(self, xslt_input, extensions = extensions)
>
>         def myfunc1(self, ctxt, a, b, c):
>             param = self.parameters["someparam"]
>             ...
>
>         def __call__(self, *args, **kwargs):
>             self.parameters = kwargs
>             return XSLT.__call__(self, *args, **kwargs)
>

That looks very promising! I will test it more and come back if I have 
further questions. :)


Thank you very much, Stefan!
Tom

-- 
Thomas Schraitle


More information about the lxml-dev mailing list