Name

<xsl:param>

Defines the name and value of a parameter to be used in a stylesheet. This element can appear as a top-level element or inside the <xsl:template> element. If the <xsl:param> appears as a top-level element, it is a global parameter, visible to all areas of the stylesheet. The default value of the parameter can be defined in one of two ways: specified in the select attribute or defined inside the <xsl:param> element itself. [2.0] In XSLT 2.0, <xsl:param> can also appear inside the new <xsl:function> element.

Category

Instruction.

Required Attribute

name

Defines the name of this parameter.

Optional Attributes

select

Contains an XPath expression that defines the value of this parameter.

[2.0 – Schema] as

Defines the datatype of this parameter. The datatype can be any of the built-in types or, if you have a schema-aware XSLT processor, a datatype defined in an XML Schema. For example, as="xs:integer" specifies a parameter that is a single integer, and as="xs:string*" specifies a parameter that is a sequence of zero or more strings. With a schema-aware XSLT processor, as="schema-element(po:purchase-order)" means that the parameter must be a valid po:purchase-order.

[2.0] required

Defines whether this parameter is required. Valid values are yes and no. If this is a parameter for an <xsl:function>, this attribute must not be defined. For stylesheet and template parameters, the default value is that the parameter is optional (required="no").

It is a static error if an <xsl:param> element ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.