This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Dimitre Novatchev wrote:

> Recently I gave an example of dynamic creation of new functions. It described a
> "store" of variables and their values for a calculator. Maybe this could be helpful?
> 
> http://aspn.activestate.com/ASPN/Mail/Message/xsl-list/920880
> 


And I was all extatic last night about it. However, apart from
this fairly elegant (though pretty obscure) generic template
approach, your "store" is just the same as my environment. You
still have to pass it down the call graph as explicit parameters
and you loose it if you have a node in the call chain that does
not pass it on. So, this does not solve the problem.

Also, to the earlier discussion about variables: once again I
notice that your use of variables is as static bindings only,
just like constants. You would not need any of this if the
XSLT language had the simplicity of LISP where you could just
use the result of one function in the application in the next
function. The only real need for your variables is to do the
node-set() function call, because of this split between XML
XSLT on the outside and the XSLT-extended xpath expressions
on the inside.

So, I don't let it go just yet. The variable construct in XSLT
is not very useful and dynamic binding as at least an optional
declareable feature would be a very, very, useful feature that
I kindly ask to be added to XSLT next revision.

This would be declareable as:

<xsl:variable name='foo' select='bar' dynamic='true'/>

think about it or please let me know why this is so much
felt to be such a bad idea? The implicit parameter
paper is also based on Haskell, and people kept suggesting
dynamic scoping as extensions to scheme. There seems to
be a fairly strong vote by the people out there to want
to add dynamic scoping back into languages that deliberately
have cut that out for some theoretically righteous reasons.
(This again is just a challenge to stir up a response,
rather than a rant or a flame.)

regards
-Gunther


>>>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.
>>
> 
> 
> This is what it would take:
...


> In any event, it's a lot of burden to do for routine use
> just in case someone wants to have a few dynamically scoped
> variables.


-- 
Gunther Schadow, M.D., Ph.D.                    gschadow@regenstrief.org
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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]