Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

xsl:variable

Syntax

Description

Declare a local or global variable. If the <xsl:variable> instruction appears at the top level of the style sheet as a child of the <xsl:stylesheet> document element, it is a global variable with a scope that includes the entire style sheet. Otherwise, it is a local variable with a scope of its following siblings and their descendants.

Attributes

name

Specifies the name of the variable. After declaration, the variable can be referred to within XPath expressions using this name, prefixed with the $ character.

select

(Optional) Determines the value of the variable. The value of the variable is determined either by the select attribute or by the contents of the <xsl:variable> element. Do not specify both a select attribute and some content; we recommend using the select attribute so as not to create a result tree fragment.