xsl-list
[Top] [All Lists]

RE: [xsl] How to take a QName value and make it an attribute?

2012-08-01 11:03:01
Thanks Andrew, Andrew, Michael, and David.

With this input:

    <fault>soap:client</fault>

This template rule:

    <xsl:template match="fault">
        <xsl:copy>
            <xsl:variable name="q" as="xs:QName" select="resolve-QName(., .)" />
            <xsl:attribute name="{$q}" 
namespace="{namespace-uri-for-prefix(prefix-from-QName($q), 
.)}">blah</xsl:attribute>
            <xsl:value-of select="." />
        </xsl:copy>
    </xsl:template>

Produces this output:

    <fault xmlns:soap="http://www.soap.org"; 
soap:client="blah">soap:client</fault>

Perfect! 

Exactly what I want.

/Roger




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--