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

RE: how can I modify global variables ?

Subject: RE: how can I modify global variables ?
From: "Ben Robb" <b.robb@xxxxxxxxxx>
Date: Thu, 12 Apr 2001 12:54:26 +0100
modify global variable
Moreover, a variable defined in one template is not accessible in other
template, since it is in local template scope. A *globally* scoped
variable is defined as a child of the <xsl:stylesheet> node. This also
cannot be changed once set. Understanding why this is so is almost
always the first major conceptial problem people have to get through to
understand XSLT.

The reason why you cannot change a variable once it has been set is
because of the fact that it is a functional programming language [and
I'm not going to even try and explain what that means with people like
David Carlisle on the list *grin*]. Basically, XSLT is a so-called
"side-effect free" language - that is, the processor does not have to
deal with the fact calling a template might change a variable, and so
does not have to keep track of the variable value in memory. This leads
to generally faster processors of a language.

All that said, when you come down to it, the practical implication of
this is that you cannot change a variable or parameter once set.... and
I've yet to find a situation where this is an insurmountable problem -
you just need to think about the problem in a slightly different way.

Ben

> -----Original Message-----
> From: FINLEY, Mike [mailto:Mike.FINLEY@xxxxxxxxxx]
> Sent: 12 April 2001 12:20
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  how can I modify global variables ?
> 
> 
> The short answer is "you can't". Once a variable is created, its value
> cannot be changed.
> 
> -----Original Message-----
> From: Gabriel Erzse [mailto:erzse.gabriel@xxxxxxxxxxx]
> Sent: 12 April 2001 11:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  how can I modify global variables ?
> 
> 
>     If I have template called "root" (for example) where I defined a
> variable called "rowCount" and from "root" template I call 
> another template
> called "compute", is it possible to change the value of the "rowCount"
> variable from inside "compute" template ?
> 
>    If yes, how can I do it ?
> 
>    Thanks,
>    Gabriel Erzse.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> ______________________________________________________________
> _____________
> This email is confidential and intended solely for the use of the 
> individual to whom it is addressed. Any views or opinions 
> presented are 
> solely those of the author and do not necessarily represent those of 
> Sema. 
> If you are not the intended recipient, be advised that you 
> have received this
> email in error and that any use, dissemination, forwarding, 
> printing, or 
> copying of this email is strictly prohibited.
> 
> If you have received this email in error please notify the Sema UK
> Helpdesk by telephone on +44 (0) 121 627 5600.
> ______________________________________________________________
> _____________
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 

 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.