Subject: Re: [xsl] Reference to variable cannot be resolved. From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 14 Feb 2003 12:33:42 GMT |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Reference to variable can, Andrew Welch | Thread | RE: [xsl] Reference to variable can, Andrew Welch |
Re: [xsl] Reference to variable can, Jeni Tennison | Date | Re: [xsl] Reference to variable can, David Carlisle |
Month |