Is there anyway to use the contents of a variable as the value of the
'name' attribute of an <xsl:attribute>?
Suppose I have this XML input:
<Foo>
<Bar>Baz</Bar>
</Foo>
What I'd like to generate (ignore any <xs:include> requirements) is:
<xs:element ref="Baz:Baz" xmlns:Baz="A:B:C:Baz"/>
Here's what I have so far:
<xsl:template match="Foo">
<xsl:element name="xs:element">
<xsl:attribute name="ref">
<xsl:value-of select="Bar"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="Bar"/>
</xsl:attribute>
<xsl:variable name="bazNamespace">
<xsl:text>xmlns:</xsl:text>
<xsl:value-of select="Bar"/>
</xsl:variable>
<xsl:attribute name="How-{$bazNamespace}-DoesntWork">
<xsl:text>A:B:C:</xsl:text>
<xsl:value-of select="Bar"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
Obviously I could manually build the <xs:element> with a bunch of
<xsl:text>, but that's crummy. Any ideas?