Next / Previous / Contents / TCC Help System / NM Tech homepage

8.5. <xsl:param>: Define an argument to be passed into a template

The template is the basic module or building block of the XSLT stylesheet. The <xsl:param> element allows you to write a template that can take argument (parameter) values.

Each parameter to a template must have a unique name, supplied via the name attribute.

When a template is applied, the values of its parameters are determined by this process:

  1. If the calling template supplies a value for the parameter by using an <xsl:with-param>, the parameter will be set to that value.

  2. If the calling template does not supply a value, but the <xsl:param> element defines a default value, the parameter is set to that default value.

  3. If the <xsl:param> element of the template doesn't supply a default value, the parameter is set to an empty string.

There are two ways to specify the default value of a parameter. You can supply the value as a select attribute, or you can put the value inside the content of the <xsl:param> element. So these two constructs work the same:

    <xsl:param name="color" select="'green'"/>
    <xsl:param name="color">green</xsl:param>


name (required)

The name of this parameter.


The default value for this parameter, if any.