See xslt to operate on element value before displaying? for the original XML and XSL. I got an answer to my question there.
My other question on this same XML/XSL is: if I would like to capture the value of an element (such as the “title” element) in an XSL local variable, and then operate on it, how do I capture that value and assign it to a variable? I have the feeling it has something to do with XSL “param”, but I am not sure.
So, on that same code, what is the minimal change to the XSL so that I’ll have the value of title in a variable?
You use the xsl:variable statement to create a variable. Either of the following will work
They statement in this case would have to be within the loop.
To use the variable, you can then just do this, assuming the variable is in scope.
Please note, despite the name, xsl:variables are not variable. Once set, they cannot be changed. You would have to create a new variable with a new name if you wanted to modify the value.