Re: [xsl] Re: Assignment no, dynamic scoping si (was: Wishes for XSL revisions ...

Subject: Re: [xsl] Re: Assignment no, dynamic scoping si (was: Wishes for XSL revisions ...
From: Mark Nahabedian <naha@xxxxxxxxxx>
Date: Fri, 28 Dec 2001 14:58:17 -0500
Mike Haarman writes:
 > On Fri, 28 Dec 2001, Gunther Schadow wrote:
 > 
 > > There is even a simpler approach using only XSLT: I can make all
 > > templates use an argument that is a constructed node-set
 > > containing name-value pairs (the dynamic environment) and references
 > > to the bindings in this environment would be supported by some
 > > xpath selects in that environment node-set.
 > >
 > 
 > Thanks for the insight.  Can the dynamic environment be incorporated into
 > the internal subset via parameter entities?  Such a solution does not
 > leave interoperability entirely in crutches.

For each variable for which you would like dynamic scoping behavior,
you could include it as a parameter in all relevant template
definitions and activation sites.  If this is too cumbersome one could
develoop a shorthand for it and employ an XSLT -> XSLT transformation
to expand it.

There's still the issue of being able to override the passed in
"dynamic" value with a new one.  XSLT doesn't allow this though
[http://www.w3.org/TR/xslt#local-variables]:

    A binding shadows another binding if the binding occurs at a point
    where the other binding is visible, and the bindings have the same
    name. It is an error if a binding established by an xsl:variable
    or xsl:param element within a template shadows another binding
    established by an xsl:variable or xsl:param element also within
    the template.

so one would need to do tricky expression groveling and name mangling
to pull it off.


I've been reasobly confortable with declaring parameters and passing
them (or some derivative value) along as needed though and don't see a
shorthand for this as being worth the effort.


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


Current Thread