In XSLT, variables are the same as constants in programming and scripting languages. Variables identify generically named objects, from which a specific value can be retrieved.
Unlike programming and scripting constants, the value of an XSLT variable can be set at run time by some condition in the XML source document or in the style sheet. Because these conditions can change from one transformation to the next, these objects are known as variables rather than constants.
The <xsl:variable>
element is used to set the value of a variable. The following topics use the weatherlog.xml example to illustrate utilities of XSLT variables.
Initial XSLT Example Using Variables