[xsl] xsl:element name value with Attribute Value Template at run-time

Subject: [xsl] xsl:element name value with Attribute Value Template at run-time
From: Arvind Bassi <arvind_bassi@xxxxxxxxxxx>
Date: Wed, 29 Oct 2003 00:23:31 +0000 (GMT)
Dear All,

Many thanks in advance for any help that can be provided in this.

I am having some trouble passing in the value of a <xsl:variable> into
the name attribute of <xsl:element>, e.g. 

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet extension-element-prefixes="xslt-ext" version="1.0">
<xsl:variable name="elementName" value="foo"/>
<xsl:template match="/">
    <xsl:element name="{$elementName}">Will this work?</xsl:element>
</xsl:template>
</xsl:stylesheet>

The Xalan processor complains that the attribute name is not valid
because the $elementName variable is blank. I have tried using the
<xsl:param> element aswell, but with the same problem. Additionally, l
have tried to use $elementName by itself but the "$elementName" is not
a valid qname.

How do reference the $elementName variable so that "foo" is placed
inside the <xsl:element> element?

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread