[xsl] Re: Re: Re: Re: Increment/decrement a variable in XSL

Subject: [xsl] Re: Re: Re: Re: Increment/decrement a variable in XSL
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 4 Apr 2002 06:05:36 -0800 (PST)
Petr Cimprich <petr at gingerall dot cz> wrote:

> Dimitre Novatchev wrote:
> 
> >While I'm not a fan of EXSL, I feel offended for them -- they never
> >intended to propose extension functions for incrementing an
> >xsl:variable -- or am I wrong Jeny?
> >
> 
> Frankly, I'm not sure about intentions of EXSLTers, but since both WD

> 1.1 and 2.0 introduce an additional type of external object to be 
> used with extensions, the idea of mutable variable isn't so 
> surprising to me. 
> xsl:variable can either be bound to an external object with one or 
> more mutable properties or you don't need xsl:variable at all. Nobody

> speaks of incrementing an xsl:variable.

Then why the subject says exactly this?

And even in case the xsl:variable points to an external mutable object,
the xsl:variable itself is not mutable -- this is by definition.

> >Incrementing a variable is not a non-XSLT problem due to two
reasons:
> >
> >1. It is not "non-XSLT" XSLT -- programmers write nice programs
while
> >still being able to have the right values in the right xsl:variables
> >
> 
> Speaking of intentions, is it what XSLT has been intended for?

The "lack" of mutable variables in XSLT is not a lack of a feature, but
it is a feature -- in fact ***the feature*** that makes XSLT such an
elegant language.

> I'm not advocating extensions or mutable variables/properties. My 
> point is that there may be situations, where the extension approach 
> can be more convenient than recursive calls of templates or other 
> solutions, such as data preprocessing. Depends on what are
priorities.

Extensions can be handy when there's something, that cannot be done in
pure XSLT. Using extensions in XSLT is not a matter of convenience but
one of necessity. 

In case extensions are purely a matter of convenience for someone, then
they definitely should not use XSLT at all, but pure Javascript or
whatever else.

Even when extensions are necessary, they should be used with caution,
because (as Julian already pointed) they bring side effects into a
language that is supposed to be side effects free.


Cheers,
Dimitre Novatchev.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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


Current Thread