[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Incrementing a Global variable
Subject: RE: [xsl] Incrementing a Global variable From: Mukul Gandhi <mukulw3@xxxxxxxxx> Date: Wed, 27 Aug 2003 18:50:48 -0700 (PDT) |
Hi Americo, I guess such a construct will make certain tasks easier(e.g. generating serial nos). As Dimitre explained(and we all feel), side effect is bad for a programming language ; unless we can deviate from the notion of side effect free language, what you have suggested and I wrote (xsl:variable2 ..) might not be possible in XSLT. Regards, Mukul --- Americo_Albuquerque <melinor@xxxxxxx> wrote: > Hi > > > -----Original Message----- > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On > Behalf Of > > Mukul Gandhi > > Sent: Wednesday, August 27, 2003 7:30 PM > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: RE: [xsl] Incrementing a Global variable > > > > > > I am not asking to introduce variables as like in > > procedural languages.. We can keep xsl:variable as > it > > is, > > > > but can we introduce a syntax like xsl:variable2 > (say > > in XSLT 2.0 -- in addition to xsl:variable) which > can > > be defined at xsl:stylesheet level -- which can be > > allowed to increment. The processing model of XSLT > can > > remain same(to maintain functional programming > style); > > If what you want is increment a variable would be > better to have something > like <xsl:incremental name="value" step="2"/> to set > the incremental value > and have a <xsl:incremental-value select="value"/> > that would copy the > current value to the output and increment it by the > defined step. > > > > > > > the construct (e.g. xsl:variable2 ) can be > maintained > > in a global memory (maintained by XSLT processor) > and > > can be incremented.. > > > > for e.g. if I define <xsl:variable2 name="a" > > select="0" /> > > and possibly *any no of* other variables for e.g. > > > <xsl:variable2 name="b" .. etc. at xsl:stylesheet > level > > > > and lets assume for e.g. -- this template is being > > processed at some point.. > > <xsl:template matche="something"> > > <xsl:variable2 name="a" select="$a + 1" /> > > This will not work as expected. This means that xslt > had to "remember" the > variable state, i. e., the state before the variable > setting and the state > after the setting. Xslt hasn't this concept builtin. > > > </xsl:template> > > > > When the processor encounters the statement -- > > <xsl:variable2 name="a" select="$a + 1" /> it will > > increment the value of "a" at a global place.. > > > > Would introducing this feature will make XSLT > really procedural? > > > (...) > > Regards, > Americo Albuquerque > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Incrementing a Global var, Americo Albuquerque | Thread | RE: [xsl] Incrementing a Global var, Americo Albuquerque |
Re: [xsl] Re: Incrementing a Global, Mukul Gandhi | Date | RE: [xsl] Can attribute names be co, Dipesh Khakhkhar |
Month |
Keywords