[lxml-dev] String parameters to xslt transformation

Alexander Shigin shigin at rambler-co.ru
Fri Feb 6 14:07:44 CET 2009


Hi, Stefan,

Stefan Behnel wrote: 
> strparam() may return either an escaped string or a wrapper object that the
> transformation code special cases internally, not sure what's better.
> 
> What do you think?

I took another look at libxslt internals. There isn't any way to escape
single or double quote in argument. A citation from libxslt/variables.c,
xsltProcessUserParamInternal: 

* enclosed single quotes (double quotes). If the string which you want to
* be treated literally contains both single and double quotes (e.g. Meet
* at Joe's for "Twelfth Night" at 7 o'clock) then there is no suitable
* quoting character.  You cannot use ' or " inside the string
* because the replacement of character entities with their equivalents is
* done at a different stage of processing.  The solution is to call
* xsltQuoteUserParams or xsltQuoteOneUserParam.

So, the only way is to create a special class like XSLTQuotedVariable.
I've made a second version of the patch with `strparam()` interface.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xslt-params-2.diff
Type: text/x-patch
Size: 3693 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20090206/2ac51b45/attachment.bin 


More information about the lxml-dev mailing list