Re: [xslt] Python bindings, escaping problems
- From: Daniel Veillard <veillard redhat com>
- To: Neil Dunn <ndunn ndunn com>
- Cc: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] Python bindings, escaping problems
- Date: Fri, 14 Jan 2005 07:15:01 -0500
On Fri, Jan 14, 2005 at 11:35:34AM +0000, Neil Dunn wrote:
> As an example from this page: http://xmlsoft.org/XSLT/python.html
>
> When applying a stylesheet to a document with string parameters you
> have to do something like so:
>
> result = style.applyStylesheet(doc, { "bar": "'success'" })
>
> The comment about double quoting is:
>
> Note that the string passed "success" had to be quoted, otherwise it
> is interpreted as an XPath query for the childs of root named
> "success".
> Therefore I cannot do something as follows:
>
> result = style.applyStylesheet(doc, { "bar": "'dog\'s'" })
use """ .... """ python construct, it's really basic and the usual
way to avoid this.
style.applyStylesheet(doc, { "bar": """"dog's"""" })
this should pass down "dog's" as the string.
> If there is no way of passing in a document fragment as a string in
> this way I'm going to have to write a lot more code for what should be
> a simple thing, so I was hoping there was an easy answer to my escaping
> problems.
The correct way to pass XML markup is with document(). Passing
a fragment that way won't work properly IMHO.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]