How do I create a new HTML tag/node in XSLT ? I get the node/tag name from another variable.
+4
A:
<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.
ivan_ivanovich_ivanoff
2009-04-14 17:49:14
One thing: you may want to show how to make the element's name set via a parameter or variable as that is the OP's intention.
Andrew Hare
2009-04-14 17:50:56
+1 No need for the attribute example though. I know, I know, but the question was about elements only, and the answer does not gain completeness from it. :)
Tomalak
2009-04-14 18:15:03