Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Variable and parameter with same name and scope allowed in 2.0

From: "andrew welch" <andrew.j.welch@--------->
To:
Date: 5/2/2006 1:00:00 PM
It seems this is allowed in 2.0:



<xsl:function name="f:f">
	<xsl:param name="p"/>
	<xsl:variable name="p" select="concat($p, 'a')"/>
	<xsl:sequence select="$p"/>
</xsl:function>

The same goes for named templates - a variable is allowed to have the
same name as a parameter.

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?  Is there a good reason for this - something that I'm not
seeing at the moment?

thanks
andrew


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent