Re: [lxml-dev] Transform parameter variables

Hi, it's good practice to a) reply to the list, b) avoid top-posting and c) read what people post. Niels Bjerre wrote:
The last line will work, but as I wrote before:
Note the two stars before "the_dict". This is standard Python syntax for expanding a mapping into keyword arguments. Stefan

Stefan Behnel <stefan_ml <at> behnel.de> writes:
I'm Sorry - still no luck passing a dictionary as extentions parameter The stylesheet has a parameter: <xsl:param name="area" select="'ost'"/> The parameter is picked up in the transformation if I use: transform(doc, area="'3751'") but not when I use the_dict transform(doc, {'area':'\"\'3751\'\"'}) or any other variant of a dictionary or a dict_variable I can think of! Any suggestions is most welcome Niels

Try transform(doc, **{'area':"3751"}) Note the two stars, read up on python syntax on function calling and keyword parameters. -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

<jholg <at> gmx.de> writes:
Note the two stars before "the_dict". This is standard Python syntax for>
expanding a mapping into keyword arguments.> > Stefan> I'm Sorry - still no luck passing a dictionary as extentions parameterThe stylesheet has a parameter: <xsl:param name="area" select="'ost'"/>The parameter is picked up in the transformation if I use:transform(doc, area="'3751'")but not when I use the_dict transform(doc, {'area':'\"\'3751\'\"'}) or any other variant of a dictionary ora dict_variable I can think of!
für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Resolved! Thank You

Stefan Behnel <stefan_ml <at> behnel.de> writes:
I'm Sorry - still no luck passing a dictionary as extentions parameter The stylesheet has a parameter: <xsl:param name="area" select="'ost'"/> The parameter is picked up in the transformation if I use: transform(doc, area="'3751'") but not when I use the_dict transform(doc, {'area':'\"\'3751\'\"'}) or any other variant of a dictionary or a dict_variable I can think of! Any suggestions is most welcome Niels

Try transform(doc, **{'area':"3751"}) Note the two stars, read up on python syntax on function calling and keyword parameters. -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

<jholg <at> gmx.de> writes:
Note the two stars before "the_dict". This is standard Python syntax for>
expanding a mapping into keyword arguments.> > Stefan> I'm Sorry - still no luck passing a dictionary as extentions parameterThe stylesheet has a parameter: <xsl:param name="area" select="'ost'"/>The parameter is picked up in the transformation if I use:transform(doc, area="'3751'")but not when I use the_dict transform(doc, {'area':'\"\'3751\'\"'}) or any other variant of a dictionary ora dict_variable I can think of!
für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Resolved! Thank You
participants (3)
-
jholg@gmx.de
-
Niels Bjerre
-
Stefan Behnel