I have a stylesheet where I would prefer to insert predefined string variable in xsl text element, but can't find any pointers while searching the web.
For example:
<xsl:variable name="var" select="node()/ref/text()"/>
...
<xsl:text>Some text where I want to append $var variable desperately</xsl:text>
...
I tried with $var, ($var), {$var}...
XSLT <xsl:variable> The <xsl:variable> 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. Note: Once you have set a variable's value, you cannot change or modify that value!
The <xsl:text> element is used to write literal text to the output. Tip: This element may contain literal text, entity references, and #PCDATA.
The simplest way to do this in an XSLT stylesheet is to use the character entities for the newline ( 
 ) and tab ( 	 ) characters.
xsl:text
is only used to output fixed text, and it cannot contain nested instructions. The instruction to output variable text is xsl:value-of
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With