Name
xsl:param
Synopsis
<xsl:param name = "QualifiedName
" select = "expression
"> <! -- template -- > </xsl:param>
Inside an xsl:template
element, an xsl:param
element
receives a named argument passed to the template by xsl:with-param
. It also provides a
default value that’s used when the caller does not provide a value
for the parameter. A top-level xsl:param
element defines a global
variable that can be set from the outside environment when
invoking the stylesheet. If an xsl:apply-templates
or xsl:call-template
passes in a parameter
value using xsl:with-param
when
the template is invoked, that value overrides any default value
the xsl:param
element may have.
The parameter can be dereferenced using the form $
name
in
expressions.
Attributes
name
, requiredThe parameter’s name.
select
, optionalAn XPath expression that is evaluated to produce the parameter’s value. If
xsl:param
has aselect
attribute, then it must be an empty element. If a nonemptyxsl:param
element does not have aselect
attribute, then the value is the result of instantiating the template in the content. If an emptyxsl:param
element does not have aselect
attribute, then the value is the empty string.
Contents
An xsl:param
element’s
content is a template that is instantiated to produce a
result-tree fragment. This result-tree fragment then becomes the
parameter’s value. A nonempty xsl:param
element must not have a
select
attribute.
Get XML in a Nutshell, 3rd 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.