This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
You can't change a variable in XSLT. You'll need some other design. Passing parameters comes to mind for your example.
Joined: Jan 17, 2006
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???
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.