[lxml-dev] How to access XSLT Parameters Inside an Extension Function?
Thomas Schraitle
tom_schr at web.de
Tue Jun 10 20:30:34 CEST 2008
Hi,
On Dienstag, 10. Juni 2008, Stefan Behnel wrote:
>
> Thomas Schraitle wrote:
> > Let's say I have a couple of parameters in my XSLT file. How can I
> > access them in my extension function?
>
> You can't. Any reason why you are not just passing them into the
> function?
The reason is I'm just confused. :)
Ok, so probably you mean I just have to collect the parameter(s) (with a
XPath) and... what? From the documentation I can't find any place where I
can insert my arguments.
Let me explain my confusion a bit: For example, you have an extension
function foo:
def foo(_):
return True
As the documentation says ("What to return from a function"), you create
an XPath evaluator, for example:
e = etree.XPathEvaluator(doc)
e.evaluate("foo()")
BUT: Where do I pass my arguments? Maybe I can play with a global
variable, but I think, that would be a bad approach.
Sorry, could you give a short example to elaborate this further, please?
Thanks,
Tom
--
Thomas Schraitle
More information about the lxml-dev
mailing list