Subject: Re: using variable as a value for "use-attribute-sets"
From: Jörg Heinicke <Joerg.Heinicke@xxxxxx>
Date: Sat, 5 Jan 2002 13:27:22 +0100 (MET)
|
> Hi,
> I have a variable declared called "setname"
> I want to use it as the value of "use-attribute-sets".
> I tried this,
>
> <xsl:variable name="setname" select="name()"/>
> <xsl:element name="block">
> <xsl:attribute name="use-attribute-sets"><xsl:value-of
> select="$setname"></xsl:attribute>
> </xsl:element>
> but it results in <block use-attribute-sets="node-name"/>
>
> can anyone tell me someway?
>
> -tony
Of course it can't work, because you only add an attribute to <block> named
'use-attribute-sets' - nothing more. But 'use-attribute-sets' must be an
attribute of <xsl:element> no in the output, but in the input.
So it has to be
<xsl:element name="block" use-attribute-sets="$setname"/>
or
<block xsl:use-attribute-sets="$setname"/>.
But there is only one problem: use-attribute-sets doesn't seem to be allowed
with variables. MSXML throws an error, Xalan ignores it. The changing to
use-attribute-sets="{$setname}" doesn't help either.
So I can only give you a hint, why your code doesn't work, but not how to
solve it.
Regards,
Joerg
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|