[XML-SIG] 4xslt - passing parameters

Matt Gushee Matt Gushee <mgushee@havenrock.com>
Sat, 9 Nov 2002 23:34:57 -0700

On Sat, Nov 09, 2002 at 11:22:34PM -0700, Mike Olson wrote:
> > 
> > Yes, you should be able to do that. How exactly are you invoking the
> > transformation? If you have a Processor instance proc, and you are calling,
> > e.g.
> >   
> >   proc.runStream(str)
> >   
> > then you can simply add the keyword argument topLevelParams with a
> > dictionary of parameters as its value. For example:
> > 
> >   result = proc.runStream(str, topLevelParams={'page': 27})
> I'm not sure if this works, though it might (let me know if it does). 
> The problem is that the key in the dictionary must contain the namespace
> of the variable as well.  So assuming the variable is referenced as
> "$page" then the dictionary that is passed in must be:
>   {('','page'),27}

Okay ... I'm not saying this is wrong (you know this stuff better than I
do, of course), but why do you need to pass a namespace, when XSLT
parameters don't have namespaces? And why is it an empty string, when
null namespaces for elements and attributes are represented as None?

Inquiring minds want to know.

Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                            --Lao Tzu (Peter Merel, trans.)