RE: AW: [xsl] xsl:variable

Subject: RE: AW: [xsl] xsl:variable
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Thu, 22 Jul 2004 11:49:23 -0400
> From: Evan Wellens [mailto:evanw@xxxxxxxxxxxxxxxxxxxx]
>
> Many thanks , this has been driving me crazy..

Just to summarize the responses, in xslt you have basically two
approaches when you find yourself wanting to modify a global variable
within a template -

1) Pass it into the template as a parameter and compute deltas to get
the current value you want.  This may or may not require a recursive
approach depending on what you want to do and the design of your
template.

2) Compute the value you want based on some local criteria, such as
position, count of ancestors, etc.

If you ask why you are not allowed to change the value of a variable
once it is bound, reflect on the fact that in xslt, the order of
operations is not specified.  You should just assume that templates may
be invoked in any order and assembled correctly later on.  Given that,
you definitely would not want to modify a global variable, since you
would never know what its current value would be at any template
invocation!

Cheers,

Tom P

Current Thread