| Author |
how to reset the variable value in xsl
|
Christian Nash
Ranch Hand
Joined: Jan 17, 2006
Posts: 107
|
|
Hi, I have declared a variable value as <xsl:variable name="flag">false</xsl:variable> Now when i call a particular template rule, I want to change the value of this variable to 'true'. How do i do it such that the change reflects globally? How do i then access this variable value?
|
- Christian
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
You can't change a variable in XSLT. You'll need some other design. Passing parameters comes to mind for your example.
|
 |
Christian Nash
Ranch Hand
Joined: Jan 17, 2006
Posts: 107
|
|
Hi, How can i implement a global boolean variable functionality in xsl? When the xsl is called the value of this boolean variable is already defined(say false). During some program flow(in some template rule), I want to change the value of this boolean variable to something else(say true). I cannot implement this with xsl:variable and xsl arameter since the values of these cannot change once declared. How do I do this?? any ideas???
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
You need a function that calculates the value of that "variable" in whatever context your code is in. Bear in mind that XSLT is a functional programming language, so time is not a concept. A function will always return the same value for the same inputs. So you will need to throw away the idea that your variable is true until event X happens and then it's false. You need to find a function that describes your variable in terms of how your input document is and not in terms of how you process the document. If we had a more detailed description of your problem we might be able to say something more specific.
|
 |
Christian Nash
Ranch Hand
Joined: Jan 17, 2006
Posts: 107
|
|
Thanks a lot Paul. Solved the issue.
|
 |
 |
|
|
subject: how to reset the variable value in xsl
|
|
|