[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Reference to variable cannot be resolved.
> As I understand it, variables are scoped using a 'variable stack' - > when a new template is matched, a new 'layer' is added to the stack > that will contain the variables declared in that template. Should a > new template be called/applied in the middle of that template, then a > new layer is added to the stack. That's describing the efect in terms of the run time dynamic behaviour. A more declarative description (which is the model in my head, which explains why I said "you can have two variables...") is that each variable has a (hidden) unique name. when you go $x then it refers to some variable that was defined with name="x", and you can tell which one that was statically by the position of the reference in the program: it doesn't depend on the calling order of the templates as it would in a language with dynamic binding. So you may as well assume that the compiler has just internally renamed every variable declaration and variable reference so that they all have different names and so "scope" isn't an issue when the templates are being executed. Of course an actual implementation probably does something completely different again but who cares about implementations:-) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|