xsl-list
[Top] [All Lists]

[xsl] How to give an attribute a QName value, with the appropriate prefix?

2012-08-27 15:37:45
Hi Folks,

I want to transform this:

    <xs:attribute name="test" />

to this:

      <xs:attribute name="test" type="xs:anySimpleType" />  

Here is the code that I tried:

    <xsl:template match="xs:attribute">
        <xsl:copy>
            <xsl:copy-of select="@*" />
            <xsl:attribute name="type"><xsl:value-of 
select="QName('http://www.w3.org/2001/XMLSchema', 'anySimpleType')" 
/></xsl:attribute>
            <xsl:sequence select="node()" />
        </xsl:copy>
    </xsl:template>

Unfortunately that code produces this:

      <xs:attribute name="test" type="anySimpleType" />

Notice that there is no prefix on anySimpleType.

What's the best way to accomplish my objective?

I want the prefix on anySimpleType to match the prefix on the <attribute> 
element, whether it be xs: or xsd: or anything else.

/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>
--~--