GNOME Bugzilla – Bug 114563
with-param, apply-templates($contextNode)
Last modified: 2009-08-15 18:40:50 UTC
Hi I found a bug in libxslt 1.0.27, I think it is not fixed in the current release... Stylesheet: ---------------------------------------- ?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:output method="xml" encoding="utf-8" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="document('test.xslt')" mode="test"> <!-- <xsl:apply-templates select="//xsl:param" mode="test"> --> <xsl:with-param name="text">asdf</xsl:with-param> </xsl:apply-templates> </xsl:template> <xsl:template match="*" mode="test"> <xsl:param name="text"/> <p> <xsl:value-of select="$text"/> </p> </xsl:template> </xsl:stylesheet> ---------------------- Use filename: test.xslt xsltproc test.xslt test.xslt The xsl:param is not working. Bernhard http://datenkueche.com
The semantic of: <xsl:apply-templates select="document('test.xslt')" mode="test"> applies the template to the *document* node from the result of parsing test.xslt with mode="test", which is not defined, so it fallbacks to handling the children of that node and nothing is output. Changing to <xsl:apply-templates select="document('test.xslt')/*" mode="test"> generates <?xml version="1.0" encoding="utf-8"?> <p xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">asdf</p> which you expect. Seems mode is not cascaded in templates fallbacks. Apparently it looks like an actual libxslt bug ... I will try to fix this... Daniel
The problem was that parameters were not passed when the fallback (default template) case took place. Fixed in CVS - thanks for the report.
This should be closed by the release of libxml2-1.0.33, thanks! Daniel