Variables

A variable is a named object that holds a value. A number of references can be made to the variable wherever that value is needed, and each reference is replaced by the value when the stylesheet is processed.

Use of a variable could be considered whenever the same value appears in two or more places in the stylesheet, and there is no reason to believe that the values in each place will ever be different from each other. For example, if important text is always presented on a red background, and there are a number of places where, for this purpose, the colour red is specified in the stylesheet, then the CSS instruction 'background-color:red' could be replaced with the variable name 'important'. There are two clear benefits. First, the ...

Get XSL companion, The 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.