Variable Scope

An <xsl:variable> element is scoped to the element that contains it. If an <xsl:variable> element is a top-level element (its parent is <xsl:stylesheet>), it is global, and its value is visible everywhere in the stylesheet. You can also use an <xsl:variable> element within an <xsl:template> to override the value of a global variable locally.

Get XSLT, 2nd Edition 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.