Hi Petr, Petr van Blokland wrote:
rq = None
... global rq rq = httprequest # e.g. coming from Twisted Matrix xsltree.transform(xmltree) ...
Where an external XPath function might be implemented as:
externalfunction(dummy, value): from xxxx import rq rq.value = value
This may or may not work, depending on Python's way of handling local imports. You should really store the value in the function (either closure or class).
The question is about: is this the way to do it, or is there/will there be a way to pass the rq through XSLT.
As I said, I'd register a stateful object as function in this case. We do not currently have a way of accessing things like transform parameters or local XSLT variables from external functions. That would not work anyway for non-XPath object types. We could have something like a local context dictionary for each transformation, but I haven't seen any use cases that make the required API semantics clear enough. Stefan