Note: Once you have set a variable's value, you cannot change or modify that value!
Tip: You can add a value to a variable by the content of the o Xygen helps you learn to define, edit, validate and transform XML documents. The risk from using it lies entirely with the user.
Page The grouping column which i need to group by my XSL is in the Header section of the XML under Reports.
I need to use this Grouping Column value which is Login ID in my case to perform a grouping in XSLT.
Remember that earlier we said one goal behind the design of the stylesheet language is to avoid side effects in execution?
Well, one of the most common side effects used in most procedural languages is changing the value of a variable.Henry, Everything Mike and David has said is true, but I think the reason this is not giving the output you expect may be based on a misunderstanding about how for-each works and the nature of variable declaration in XSLT.Below I have pasted one part of your code: Call this block "B" I think you may be thinking of "B" as a type of procedure where "$foo" is being defined. "B" is not merely a procedure in which you define $foo.If we write our stylesheet so that the results depend on the varying values of different variables, the stylesheet engine would be forced to evaluate the templates in a certain order.XSLT variables are more like variables in the traditional mathematical sense.February 7, 2001 Bob Du Charme A variable in XSLT has more in common with a variable in algebra than with a variable in a typical programming language.It's a name that represents a value and, within a particular application of a template, it will never represent any other value -- it can't be reset using anything described in the XSLT Recommendation.Then, if you need to change the value when re-using the stylesheet, you only change the value assigned in the creation of that variable.For example, imagine that we want to turn this XMLWhen referencing a variable or parameter from a literal result element's attribute, you want the XSLT processor to plug in the variable's value.element is used to declare a local or global variable.Note: The variable is global if it's declared as a top-level element, and local if it's declared within a template.