You declare a variable using xsl:variable
<xsl:variable name="var-name-1">value</xsl:variable> <xsl:variable name="var-name-2" select="expression"/>
They can be used in attribute value templates and XPath expressions:
<value name="{$value-name}"/> <xsl:apply-templates select="$somewhere/items"/>
If a variable's value is a node, you can select against it with step expressions.
Variable names follow the same rules as elements:
They can be QNames (qualified by a namespace).
Prefixes resolve against the stylesheet document's namespace declarations.