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

Re: remaining problem w/ dyn var scoping, as proposed

Subject: Re: remaining problem w/ dyn var scoping, as proposed (and solution?)
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Jan 2002 13:28:30 -0500
Re:  remaining problem w/ dyn var scoping

I agree that implicit parameters should be scoped by a namespace
just like tags should so there would not be conflicts. I'm not
sure if namespaces should be used for the parameter name or if
the scope attribute should carry the name of the scope. Actually,
I personally like your scope attribute more, but wouldn't namespaces
be more according to common practice?

The neat thing about the scope attributes is that they make
it very straightforwardly clear how to implement this:
Just make each named 'scope' an association list. Using deep
binding is not a problem here because it can be expected that
only a few hand full of variable names would be in each 'scope'.

I also like your proposal for requiring implicit parameters to be
passed on once they are 'caught.' That results in even less dark
magic happening behind the scene without the explicit agreement
by the programmer. It would make implicit parameter even more
closely aligned to explicit parameters.

I don't care if parameter passing is verbose in XSL, everything
is verbose in XML, so I better get used to that :-) The only
purpose of implicit parameters is to pass them through templates
that don't care about them.

Here is an example of all of this:

<xsl:template ...>
  <!-- all implicit parameters used must be declared in the
       current lexical scope. -->
  <xsl:param scope='foo' name='text-color' select="'black'"/>
  <xsl:param scope='foo' name='text-indent' select="''"/>
  <xsl:param scope='foo' name='text-size' select="10pt"/>

<out color="{$text-color}"/>

  <xsl:apply-templates ...>
    <!-- all implicit parameters declared in this lexical
	 scope must be passed forward explicitly. -->
    <xsl:with-param scope='foo' name='text-indent'
                    select="concat($text-indent,'  ')"/>
    <xsl:with-param scope='foo' name='text-size'

The only funny thing with this pass-forward requirement is that
it is actually more work to implement, because the XSLT engine
needs to positively find out which parameters of the current
lexical scope (including the global scope!) are not on the
with-parameter list and then assign a 'NULL value' to those such
that their current binding would not be retrievable in an inner
dynamic scope. That may be more work for little additional


[Cutting out my formal signature :-)]

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

Current Thread


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.
First Name
Last Name
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.