Subject: Re: [xsl] Re: Assignment no, dynamic scoping si (was: Wishes for XSL revisions ... From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 28 Dec 2001 17:40:47 -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.
Yea, that's truly a lot of work and you should either do this everywhere or nowhere, because the point of dynamic bindings is that they are available anywhere in the call graph. So, if you have some template in the middle that has not passed the binding on because it was believed that this template would not be called here ... yor dynamic binding would be lost. If anything is not good XSLT, then the assumption that certain templates are being invoked in a certain order.
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 don't see that as a problem. Really, I have no problem accepting that a binding cannot be used as a counter etc. I have no issue with "changing variables" as you change the content of a storage cell. I really only care about dynamic scoping so that you can put a few default things in a context to be able to refer to but also to override as you go down the execution graph. That can be easily done by just passing the new binding as the parameter.
The only problem again is that you cannot rely on a few hacks here and there to add those parameters. You need to do it everywhere. Indeed, that could be done with an XSLT on XSLT, but it's something you have to remember doing and all of that is a lot of hassle and slows everything down for a feature only needed in a few cases.
regards -Gunther
Static Types" from Jeffrey Lewis et al. has become pretty famous for a description of what these dynamic scopes are good for and how they can be made work nicely. [http://citeseer.nj.nec.com/246042.html]
-- Gunther Schadow, M.D., Ph.D. gschadow@xxxxxxxxxxxxxxx Medical Information Scientist Regenstrief Institute for Health Care Adjunct Assistant Professor Indiana University School of Medicine tel:1(317)630-7960 http://aurora.regenstrief.org
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: Assignment no, dynami, Mike Haarman | Thread | Re: [xsl] Re: Assignment no, dynami, Gunther Schadow |
Re: [xsl] Re: Assignment no, dynami, Gunther Schadow | Date | Re: [xsl] Literal string question, Trevor Nash |
Month |