RE: how can I modify global variables ?
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format