GNOME Bugzilla – Bug 677901
xslt forwards compatible mode does not work
Last modified: 2017-02-10 12:33:45 UTC
The stylesheet below: <?xml version="1.0" encoding="UTF-8"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:test="#tes t" xmlns:tc="mailto:julian.reschke@greenbytes.de?subject=xslt" version="2.0"> <xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" indent="no"/> <xsl:template match="/"> <html> <head> <title>xsl:function</title> </head> <body> <xsl:choose> <xsl:when test="function-available('test:test')"> <p> Result: <xsl:value-of select="test:test()"/> </p> </xsl:when> <xsl:otherwise> <p> <tt>xsl:function</tt> not supported, but properly handled ( ignored)</p> </xsl:otherwise> </xsl:choose> </body> </html> </xsl:template> <xsl:function name="test:test">YES</xsl:function> </xsl:transform> should either result in "YES", or in "xsl:function not supported, but properly handled (ignored)". Instead, it aborts with: compilation error: file ... line 30 element function (see also http://greenbytes.de/tech/tc/xslt/#ft-xsl-function and http://www.w3.org/TR/xslt#forwards)
Proposed fix: https://github.com/nwellnhof/libxslt/commit/67b663241f7e347644419ceb7919152cf8072fb0
Looks good, I just made a couple of small tweaks and pushed upstream, http://git.gnome.org/browse/libxslt/commit/?id=faeaa3146cab124628785c4b536ba0b824292f8d thanks a lot ! Daniel
Hello, this fix from 2012 is not complete: libxslt doesn't ignore element content: <xsl:function name="test:test"> <xsl:param name="x"/> <xsl:sequence select="$x"/> </xsl:function> will fail ("element param only allowed within a template, variable or param"). Additionaly it would be nice if it would not emit a message for every unknown element: I think saying "xsl:version: only 1.0 features are supported" is enough... (and for that last message, it doesn't print in case version="1.1") François
Fixed with the following commits: https://git.gnome.org/browse/libxslt/commit/?id=af31ef183b0c7032ac312c8217f62e3fa5425250 https://git.gnome.org/browse/libxslt/commit/?id=92a43f5669437647fb57a6255bbd27e762f3c10a https://git.gnome.org/browse/libxslt/commit/?id=a8ad51d20ff01042f7c0c1a8e34f8c14e5ee3ef1
Thanks, and felicitation for fixing so fast!
*** Bug 778435 has been marked as a duplicate of this bug. ***