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

remaining problem w/ dyn var scoping, as proposed (and

Subject: remaining problem w/ dyn var scoping, as proposed (and solution?)
From: "Matt G." <matt_g_@xxxxxxxxxxx>
Date: Thu, 03 Jan 2002 09:12:02
 remaining problem w/ dyn var scoping
I've actually struggled with the use case put forth as the need for dynamic variable scoping. One approach I used to deal with having to add a new parameter, that I wanted passed through to one of my call-backs, was to add an entity reference to all the templates in my stylesheet library. Unfortunately, this does mean that you can't treat the stylesheet library as a black box. However, it made it easy to extend.

I'm just mentioning that as a suggestion to those who may also have to face this problem with an XSLT 1.0 processor (which means you can't use the node-set trick).

Despite having faced this very problem, myself, I didn't like the idea of dynamic-scoping, at first. After I started to see that most of the associated risks could be mitigated or eliminated, I started to warm up to the idea. However, I've spotted one more vulnerability in Dr. Schadow's proposal: namespace collisions among dynamically-scoped variables. What it really comes down to is that two scopes (lexical vs. dynamic) aren't enough. That's not an impossible problem to fix, however. In fact, I think the solution is quite straight-forward. Rather than <parameter scope="dynamic>/> how about using the value of the scope attribute (if present) to be treated as the name of a scope? This allows you to really treat a stylesheet library as a black box (even if it uses several stylesheet libraries, itself), without risking mucking with its inner workings via dynamic-variable namespace collisions.

In fact, I was even thinking that a template which accepts a dynamic variable as dynamic should terminate its scope (i.e. it doesn't get passed down to the next tier of the call-tree, if not done explicitly), by default. However, if the scopes are named, I don't see any advantage to doing this, unless the same template library is used at multiple places in a single call-stack (wait... maybe that's reason enough to do it).


Thanks for considering my suggestion. BTW, XSLT/XPath 2.0 is looking very promising. Cheers to everyone involved!



Matthew Gruenke



_________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com


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.