Name
xsl:variable
Synopsis
<xsl:variable name = "QualifiedName
" select = "expression
"> <! -- template -- > </xsl:variable>
The xsl:variable
element binds a name to a value of any type
(string, number, node-set, etc.). This variable can then be
dereferenced elsewhere using the form $
name in an
expression.
Tip
The word “variable” is a little misleading. Once the value
of an xsl:variable
is set, it
cannot be changed. An xsl:variable
is more like a named
constant than a traditional variable.
name
, requiredThe variable’s name.
select
, optionalAn XPath expression that sets the value of the variable. If
xsl:variable
has aselect
attribute, then it must be an empty element.
Contents
A template that is instantiated to produce the variable’s
value as a result-tree fragment. If an xsl:variable
is not an empty element, it
must not have a select
attribute. If xsl:variable
is
empty and does not have a select
attribute, then its value is the
empty string.
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.