Reputation: 1341
How do I create a new HTML tag/node in XSLT ? I get the node/tag name from another variable.
Upvotes: 2
Views: 2760
Reputation: 19463
<xsl:element name="{$ELEMENT_NAME}">
<xsl:attribute name="{$ATTRIBUTE_NAME}">
<xsl:value-of select="$ATTRIBUTE_VALUE"/>
</xsl:attribute>
<content>
<goes>
<here/>
</goes>
</content>
</xsl:element>
edit:
You need { and } for the "name" attributes,
but not for the "select" attribute.
SORRY! I forgot it myself in first 'version' of the answer.
Upvotes: 5