I have a stylesheet such as the one below which I want to use to strip all namespace declarations from the source tree and copy only the element and attributes to the result tree:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">
    <!-- -->
    <xsl:template match="element()|attribute()">
        <xsl:copy inherit-namespaces="no" copy-namespaces="no">
            <xsl:apply-templates select="node()|@*" />
        </xsl:copy>
    </xsl:template>
    <!-- -->
</xsl:stylesheet>

When I run Saxon-B 9.0.0.4 using this stylesheet against a document that has "xmlns" attributes (not "xmlns:xxx", just "xmlns") then the default namespaces identified in the "xmlns" attribute are copied even though "copy-namespaces=no" is specified.  When I replace the stylesheet above with the one below, then I get no namespace nodes at all in the result tree, which is what I want (I know the two stylesheets don't select exactly the same nodes - this is just for illustration):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">
    <!-- -->
    <xsl:template match="element()">
        <xsl:element name="{local-name(.)}" inherit-namespaces="no">
            <xsl:apply-templates select="node()|@*" />
        </xsl:element>
    </xsl:template>
    <!-- -->
    <xsl:template match="attribute()">
        <xsl:copy-of select="current()" />
    </xsl:template>
    <!-- -->
</xsl:stylesheet>

Shouldn't "copy-namespaces=no" on <xsl:copy> drop ALL the declared namespaces, including the default namespace?


Cheers
Chris