xsl:with-param

The xsl:with-param element is used to define an actual parameter to a template. It may be used within an xsl:call-template or an xsl:apply-templates or an xsl:apply-imports element. For an example, see the xsl:template section.

There is a mandatory attribute, name, to define the name of the parameter. The value of the parameter may be defined either by a select attribute, or by the contents of the xsl:param element, in the same way as for xsl:variable.

The parameter has no effect unless the called template includes a matching xsl:param element. But when using xsl:call-template, it is an error to specify a parameter that isn't declared in the target template, or to omit a parameter that's described in the target template with required="yes".

The attribute tunnel="yes" creates a tunnel parameter which is accessible to called templates at any depth, whether or not they are declared in intermediate templates. However, the value is only accessible if tunnel="yes" is also specified on the corresponding xsl:param element.

In XSLT 3.0, xsl:with-param can also appear as a child of xsl:evaluate, to define variables available for use within the dynamically-evaluated XPath expression, and as a child of xsl:next-iteration, to define values of iteration parameters to be used on the next iteration.