Even though I said I wouldn't consider XSLT extensions as I'm overwhelmed, Marc-Antoine brought up the module concept. I haven't played a lot with extension functions at all with libxslt, so I don't really know how it or the Python binding works now.
However, do I understand you correctly, Marc-Antoine, that instead of a dictionary of function_name->function, you would instead pass in a Python module object? Or as I see in your example, a class object.
This module object (or class object) would contain some special attributes:
* the namespace the extension functions are in
* the functions themselves
* functions used to import these functions
* a list of function names we want to register with XPath
* possibly a mapping of python names to names as to be used in xpath, for instance to handle - instead of _ or camelcase. I would prefer having no automatic translation by default, as that's a bit too much magic, but we could think about somekind of special function name translation function that you could hook into.
I haven't figured out yet where styleInit(self, stylesheet, URI) and friends fit in... Am not too clear on the use cases yet.
Hm... Need to think more.