jimifiki
jimifiki

Reputation: 5544

XSL: name a tag with a name dependent on the input xml content

I have defined a variable $myVar (meaning that the following xsl):

<xsl:value-of select="$myVar"/>

gives as output:

NiceStr

I want to create a tag:

<NiceStr/>

in a sense I would write something of this kind:

<<xsl:value-of select="$myVar">/>

which, obviously, doesn't work.

How to name a tag with a name dependent on the input xml?

Upvotes: 0

Views: 28

Answers (1)

Daniel Haley
Daniel Haley

Reputation: 52878

Try:

<xsl:element name="{$myVar}"/>

The {} is an attribute value template so the $myVar gets evaluated.

Upvotes: 4

Related Questions