Posted 2005-04-15T20:12:00+01:00 in xslt
Grmbl, I thought passing parameters to an XSLT stylesheet in libxslt was really simple. Until I actually tried to do it myself. I took me an hour before I read that when you want to pass a string as a value, you’ll need to quote it! Why? Because the python string actually is an xpath expression in itself!!
#result = style.applyStylesheet(doc, { "bar": "success"})
result = style.applyStylesheet(doc, { "bar": "'success'"})
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”.
The XSLT C library for Gnome: Python and bindings