RE: [xsl] Reference to variable cannot be resolved.

Subject: RE: [xsl] Reference to variable cannot be resolved.
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Fri, 14 Feb 2003 13:07:57 -0000
> 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.

Sure, you could modify that vision as each 'layer' in the variable stack being the namespace to the variables contained on that layer :) therefore making each variable unique:

layer1:x = foo
layer2:x = bar

However, I personally think its much easier to visualise the processor being blind to variables that are not on the top of the variable stack, and the only way to get them there is to pass them on using xsl:with-params.  

cheers
andrew

> -----Original Message-----
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: 14 February 2003 12:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] 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
> 
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
>  
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 

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


Current Thread