xsl-list
[Top] [All Lists]

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

2003-10-28 17:23:31
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



<Prev in Thread] Current Thread [Next in Thread>