GNOME Bugzilla – Bug 59480
<xsl:apply-templates> doesn't pass parameters with <xsl:with-param> when 'select' use nodeset from variable.
Last modified: 2009-08-15 18:40:50 UTC
If I use this construction: <xsl:apply-templates select="$var"> <xsl:with-param name="title" select="'new-value'"/> </xsl:apply-templates> Templates are applied Ok, but parametes are not passed. If select-expression doesn't use variables (select some nodeset inside this document), parameters works Ok too. Here is three files to reproduce bug: ======================= test.xsl == <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="var" select="document('a.xml')"/> <xsl:template match="root"> <out> Here is output with default title: <xsl:apply-templates select="$var"/> Here is output with 'new-value' title: <xsl:apply-templates select="$var"> <xsl:with-param name="title" select="'new-value'"/> </xsl:apply-templates> </out> </xsl:template> <xsl:template match="a"> <xsl:param name="title" select="'default'"/> <a-template> <title><xsl:value-of select="$title"/></title> <was-a><xsl:value-of select="."/></was-a> </a-template> </xsl:template> </xsl:stylesheet> =================================== ======================= test.xml == <?xml version="1.0"?> <root/> =================================== ========================== a.xml == <?xml version="1.0"?> <a>some text in a-tag</a> ===================================
I think the bug is in your stylesheet: select="$var" Selects the document contained in a.xml. This is a single *document* node with a single "a" child. The XSLT processors applies the templates to the selected *document* nodes, there is none, so it applies the default processing, which then process the children "a" but the inherited param is lost at that point. Not a bug ! Daniel
I think we can close this bug, Daniel