On Wed, 9 Apr 2014 08:46:20 +0100
Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
(Indeed, I'm surprised your processor did not raise a warning when
you defined $foo twice in the same scope.)
This was disallowed in XSLT 1.0, and became allowed in XSLT 2.0.
There were strong arguments on both sides.
Now that it's permitted, I sometimes take advantage of it in
constructs like
<xsl:variable name="seq" select="//x"/>
<xsl:variable name="seq" select="for $x in $seq return f($x)"/>
<xsl:variable name="seq" select="for $x in $seq return g($x)"/>
etc; using the same variable name for each stage in a sequence of
computations. But I still think it was a mistake to permit it,
because beginners (and some long-standing users like henry...)
persist in trying to write XSLT the way they write in procedural
languages, and the restriction on shadowing variables was a good way
of catching their mistake.
I can hear it now. "Oh yes you can 'update' a variable", Mike Kay
showed us how!
Shame you didn't get your way Mike.
regards
Michael Kay
Saxonica
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--