Hallo,
ja aber das wird ja gerade durch die Specs von XSLT1.0 nicht vorgesehen:
http://www.w3.org/TR/xslt#creating-attributes
XSLT processors may make use of the prefix of the QName specified in the name attribute when selecting the prefix used for outputting the created attribute as XML; however, they are not required to do so and, if the prefix is xmlns, they must not do so. Thus, although it is not an error to do:
<xsl:attribute name="xmlns:xsl" namespace="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
it will not result in a namespace declaration being output.
Ich schätze, ich habe dich missverstanden.
<xsl:variable name="nsPrefix" select="'test'" />
<xsl:variable name="nsURL" select="'http://www.example.com'" />
Die eine Möglichkeit ist:
<xsl:element name="{concat($nsPrefix, ':wert')}" namespace="{$nsURL}">
<xsl:value-of select="concat($nsPrefix, ':norm')"/>
</xsl:element>
Was zu: <test:wert xmlns:test="http://www.example.com">test:norm</test:wert> führt.
oder du machst es auf die "unschöne" Art:
<xsl:text disable-output-escaping="yes"><wert xmlns:</xsl:text><xsl:value-of select="$nsPrefix" />xsl:text="</xsl:text><xsl:value-of select="$nsURL" /><xsl:text disable-output-escaping="yes">"></xsl:text>
<xsl:value-of select="$nsPrefix" />:norm
<xsl:text disable-output-escaping="yes"></wert></xsl:text>
was zu <wert xmlns:test="http://www.example.com">test:norm</wert>
Grüße
Thomas