O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

<xsl:with-param>

Defines a parameter to be passed to a template. When the template is invoked, values can be passed in for the parameter.

Category

Subinstruction; <xsl:with-param> always appears inside the <xsl:apply-templates> or <xsl:call-template> element.

[2.0] In XSLT 2.0, it can also appear inside the new <xsl:apply-imports> and <xsl:next-match> elements.

Description

<xsl:with-param> defines a parameter to be passed to a template. When a template is invoked, values can be passed in for its parameters. The value of a parameter can be defined in one of three ways:

  • If the <xsl:with-param> element is empty and does not contain a select attribute, then no value is passed to the template.

  • If the <xsl:with-param> element is empty and has a select attribute, the value of the parameter is the value of the select attribute.

  • If the <xsl:with-param> element is not empty, the value of the parameter is the result of processing its contents.

If no value is passed to the template (<xsl:with-param name="x"/>), then the default value of the parameter, if any, is used instead. The default value of the parameter is defined on the <xsl:param> element inside the <xsl:template> itself; see the description of the <xsl:param> element for more details.

Required Attribute

name

Names this parameter.

Optional Attributes

select

An XPath expression that defines the value of this parameter. It is a fatal error if <xsl:with-param> has a select attribute and contains content.

[2.0 – Schema] as

Defines the datatype of this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required