I am trying to use XSLT variables and not having much success, hopefully I\'m just doing something dumb.
I have the following code snippet:
@lwburk's answer is great (+1), but the last question/answer is only accurate for XSLT 1.0 and 2.0. In 3.0 you can use a TVT (Text Value Template; similar to the AVT (Attribute Value Template) mentioned in @lwburk's answer).
To use a TVT, add the standard attribute xsl:expand-text="yes" to the element. This will cause the processor to treat descendant text nodes of that element as a TVT.
Example:
XSLT 3.0
This is {$who}'s result: {$what}
Output (using any well-formed XML as input)
This is Dan's result: BAM!
Note: Tested using Saxon-PE 9.5.