Variables and named templates
A stylesheet often contains a number of templates that produce identical or very similar output. XSLT includes some mechanisms for avoiding such redundancy.
A 'variable' is a container of information that has a name. Whenever the variable is referenced in the stylesheet, the reference is replaced by the value of the variable.
Variables are declared using the Variable element. The name of the variable is given in the Name attribute, and the value of the variable may be the content of the element. The following example creates a variable called 'Colour', and gives it the value 'red':
Alternatively, the value can be generated from an expression using a Select attribute. ...