Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create element with variable name?

Status
Not open for further replies.

sheila11

Programmer
Dec 27, 2000
251
US
Hi all,

I need to create an element, with a name that is read from a variable. I tried:

<xsl:element name="$vName">
<!-- some stuff here -->
<xsl:element>

but it doesn't work. What's the correct way ?

TIA,
Sheila
 
Ok, I found the solution:
<xsl:element name="{$vName}">

I guess that {} forces the evaluation of the variable. But don't know why I don't need {} everywhere.

Sheila
 
{} tells the processor that inside those brackets is an XPath expression. In this case a variable. Curly brackets are very useful.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top