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

RE: Variable and parameter with same name and scope a

Subject: RE: Variable and parameter with same name and scope allowed in 2.0
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Tue, 2 May 2006 15:39:04 +0200 (CEST)
my same name
andrew welch wrote:

> I can see how its possible - the variable will always come
> after the parameter, so it will always 'win' when it comes
> to scope.  My concern is that this sort of thing would
> usually end up from a mistake, and then get silently
> handled by the code - it's shadowing, and its well known
> how many problems that can cause.

> I've only tried this with Saxon 8.7.1 so I'm assuming it's
> intentional?

  It seems to be.  '9.2, Parameters:

    Local variables may shadow template parameters and
    function parameters: see 9.7 Scope of Variables.

  '9.7, Scope of Variables:

    [Definition: 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 also not an error if a binding established by a
    local xsl:variable or xsl:param element shadows another
    binding established by another local xsl:variable or
    xsl:param.

> Is there a good reason for this - something that I'm not
> seeing at the moment?

  I don't know the idea of the members of the WG.

  Personaly, I used this in generated XSLT.  In some case,
it's clearer than the 1.0 version, where it is an error to
have two variables of the same name in the same template
rule (even in different "scopes", for example outside and
inside an xsl:if).

  But in such a case, I can usualy use generate-id().

  Regards,

--drkm

























	

	
		
___________________________________________________________________________ 
Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services prifiris : virifiez vos nouveaux mails, lancez vos recherches et suivez l'actualiti en temps riel. 
Rendez-vous sur http://fr.yahoo.com/set

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.