[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Incrementing a Global variable

Subject: RE: Incrementing a Global variable
From: Americo Albuquerque <melinor@xxxxxxx>
Date: Wed, 27 Aug 2003 22:38:22 +0100
xsl variable global
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:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.