Iris
Iris

Reputation: 1341

XSLT create new HTML tag

How do I create a new HTML tag/node in XSLT ? I get the node/tag name from another variable.

Upvotes: 2

Views: 2760

Answers (1)

ivan_ivanovich_ivanoff
ivan_ivanovich_ivanoff

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.

Read about here.

SORRY! I forgot it myself in first 'version' of the answer.

Upvotes: 5

Related Questions