I tried this but it does not seem to be valid syntax.
<xsl:element name="$myElementName"></xsl:element>
I tried this but it does not seem to be valid syntax.
<xsl:element name="$myElementName"></xsl:element>
You may need to surround it with {}
to ensure the value is evaluated rather than used as a verbatim string, e.g.
<xsl:element name="{$myElementName}"></xsl:element>