Re: [xml] arguments to an XSLT transformation in Python

On Wed, May 05, 2004 at 08:17:21PM +0200, Martijn Faassen wrote:
This works, but I'd like to pass something else to the transformation 
(and thus f()) than a string or the result of an xpath expression. What 
I would to pass is an arbitrary Python object. While the XSLT 
transformation itself cannot use it, I can pass it to my Python 
extension function which then should be able to call methods on it.

I can't get this to work though. When I pass in a python object what is 
passed to f() is an empty list ([]). The only thing that seems to be 
legal to pass is an xpath expression...

  Hum, yes I think only a string will go through there.

Is something like what I want supported at all? If not, is there a 
workaround? I need to be able to get to a context object that has 
nothing to do with XSLT from my Python script. Is it possible to stuff 
such a thing (before the transformation starts) on what gets passed as 
ctx, perhaps?

  At the C level you can use the _private field of the context
to plug your own data. Maybe that could be added as a Python 
interface, but I doubt there is something which would work out of the
box right now ...


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]