xsl:with-param

Used to define an actual parameter to a template: within an xsl:call-template, xsl:apply-templates, xsl:apply-imports, or xsl:next-match element. Also used to define parameters to an iteration (using xsl:next-iteration) or to a dynamic invocation of an XPath expression (using xsl:evaluate).

Content: sequence-constructor
Permitted parent elements: xsl:apply-templates ; xsl:apply-imports ; xsl:call-template ; xsl:evaluate ; xsl:next-match ; xsl:next-iteration

Attributes

name

eqname

The name of the parameter.

select?

expression

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.

as?

sequence-type

Defines the required type of the parameter. The supplied value of the parameter will be converted to this type if required.

tunnel?

boolean

Used only when passing parameters to templates. 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.

saxon:as?

Allows additional type information to be supplied using Saxon extension syntax. For details see saxon:as.

Details

For an example, see xsl:template.

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".

Links to W3C specifications

XSLT 2.0 Specification

XSLT 3.0 Specification

See also

xsl:apply-imports

xsl:apply-templates

xsl:call-template

xsl:param