[lxml-dev] Url corruption during XSLT transformation

Stefan Behnel stefan_ml at behnel.de
Tue Jun 12 16:40:31 CEST 2007


Hi,

Alexander Kozlovsky wrote:
> I discovered a bug which is happening during XSLT transformation
> Consider this simple XSLT template:
> 
>     >>> from lxml import etree
>     >>> xslt = etree.XSLT(etree.XML('''
>     ...   <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
>     ...     <xsl:output method="html" />
>     ...     <xsl:template match="/">
>     ...       <xsl:copy-of select="." />
>     ...     </xsl:template>
>     ...   </xsl:stylesheet>
>     ... '''))
> 
> The purpose of this template is just copying all document content
> as HTML instead of XML.
> 
> But strange thing happened with urls: /test?a=1&b=2?c=3 becomes /test?a=1
> What happens is all url content after the first '&' disappears
> 
>     >>> xml = etree.XML('<html><body><a href="/test?x=10&amp;y=20&amp;z=30">sample link</a></body></html>')
>     >>> html = str(xslt(xml))
>     >>> print html
>     <html><body><a href="/test?x=10">sample link</a></body></html>

I can't reproduce that, I get the expected output.

This is on libxml2 2.6.27 and libxslt 1.1.20. Maybe your libxslt version is older?

Stefan



More information about the lxml-dev mailing list