[XML-SIG] double-encoding XSL parameters in Python with libxslt

Thomas B. Passin tpassin at comcast.net
Wed Jun 23 19:09:07 EDT 2004

Matthew Patterson wrote:
> I've got an annoying problem using Gnome libxslt's Python bindings.
> I'm passing in a global parameter (a string), which needs to be enclosed 
> in quotes. I can't guarantee that the string won't contain more quotes, 
> so to ensure that I don't terminate my quoted-string parameter early I'm 
> encoding any single quotes as ' before I pass in the string.
> libxslt is encoding my already encoded string again, so 'hello here's a 
> parameter' gets encoded to 'hello here's a parameter' by me, and 
> then to 'hello here's a parameter' by libxslt.
> If I just pass in 'hello here's a parameter' then libxslt complains 
> about terminating the string early...
> Is there any way I can avoid this?

It's presumably Python or C that's doing the escaping, so escape the 
quotes and apostrophes with backslashes.  I haven't tried it with 
libxslt, but I bet it will work.


Tom P

Thomas B. Passin
Explorer's Guide to the Semantic Web (Manning Books)

More information about the XML-SIG mailing list