[lxml-dev] setting xslt output encoding with lxml
chris hoke
cthedot at gmail.com
Sat Apr 4 11:57:46 CEST 2009
hi,
(hope this is the right list for my question)
To set the XSL output encoding I normally use <xsl:output encoding="..."/>
in the stylesheet.
At least in the Java based XSLT processors it is possible to set some
attributes of xsl:output from the "outside" meaning when initializing or
starting the transformation. So it is possible for example to overwrite any
encoding specified in <xsl:output... with a different encoding.
Is there any way to do this with LXML?
The docs only have an example to set an XSLT parameter but not an XSLT
processing configuration like the output encoding.
BTW, the example on http://codespeak.net/lxml/xpathxslt.html#xslt
>>> xslt_tree = etree.XML('''\
... <xsl:stylesheet version="1.0"
... xmlns:xsl="http://www.w3.org/1999/XSL/Transform"<http://www.w3.org/1999/XSL/Transform>>
... <xsl:template match="/">
... <foo><xsl:value-of select="$a" /></foo>
... </xsl:template>
... </xsl:stylesheet>''')
>>> transform = etree.XSLT(xslt_tree)
>>> f = StringIO('<a><b>Text</b></a>')
>>> doc = etree.parse(f)
seems to miss an <xsl:param name="a"/> parameter. I have not checked if it
works without it but I guess it would be good style to declare any incoming
parameters if not for setting a default value, would it not?
thanks for any hints,
Christof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20090404/e9d7a6e8/attachment.htm
More information about the lxml-dev
mailing list