[lxml-dev] Transform parameter variables

Stefan Behnel stefan_ml at behnel.de
Mon Jul 28 07:51:27 CEST 2008


Hi,

Niels Bjerre wrote:
> I can get transform to accept literal parameter. eg.
>  >>> transform = etree.XSLT(xsl_tree)
>  >>> result = transform(xml_tree, area="'xxx'")
> 
> 
> *But I can't get transform to accept variables!!?*
> 
> I have tried:
> 
>    - param = "area=\"\'xxx\'\""
>    - result = transform(xml_tree, param)
>    - result = apply(transform(xml_tree,param))
> 
> I have altso tried to send parameter as dictionary (as I want to send more
> parameters than one).

You can pass more than one kayword parameter, as everywhere in Python. If you
want to pass them from a dictionary, do the usual

   result = transform(xml_tree, **the_dict)

trick.

Stefan


More information about the lxml-dev mailing list