[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Reference to variable cannot be resolved.

Subject: Re: Reference to variable cannot be resolved.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 14 Feb 2003 12:33:42 GMT
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.