How to delimit a variable name in a string
-
18-02-2021 - |
Question
I want to set the attribute ref_id with "_0" suffixed, but
<xsl:attribute name="ref_id" select="$id_0" />
is parsed as variable name: id_0, not variable name id, plus string _0.
How to I nail this one down?
Thanks!
Solution
<xsl:attribute name="ref_id" select="concat($id, '_0')" />
OTHER TIPS
<xsl:attribute name="ref_id"><xsl:value-of select="$id"/>_0</xsl:attribute>
And of course if the xsl:attribute is a child of a literal result element then you can do
<e ref_id="{$id}_0">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow