Re: [xsl] Scope of variables

Subject: Re: [xsl] Scope of variables
From: "Mike Haarman" <mhaarman@xxxxxxxxxxxxxxxxxx>
Date: Thu, 8 May 2003 15:19:14 -0500
----- Original Message ----- 
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>

> The scope of the variable is the enclosing block, which in this case are
> "when" or "otherwise" blocks.  This question comes up all the time on
> the list.  Just check the FAQs and pay attention to some of the other
> threads.  Outside its scope the variable is not available.

There is a common gotcha, as well.

It should be noted that variables in template bodies and not constrained to the
template bodies of blocks, as above, scope to the template enclosing their
declaration and all following::sibling templates and their children in document
order in the stylesheet, yet not to child templates called or applied from
within that declaring template.  Variables declared at the top-level of the
stylesheet are available throughout the transformation.

hth,

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread