This transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common" exclude-result-prefixes="ext">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="a" select="'Total'" />
<xsl:variable name="b" select="'500'" />
<xsl:template match="/*">
<xsl:variable name="rtfX">
<xsl:element name="{$a}">
<xsl:value-of select="$b"/>
</xsl:element>
</xsl:variable>
<xsl:value-of select="ext:node-set($rtfX)/Total"/>
</xsl:template>
</xsl:stylesheet>
when applied on any XML document (not used), produces the wanted, correct result:
500