copy-namespaces="no" not honoured for (xsi?) namespace

Added by Martin Honnen 10 months ago

It seems Saxon Java doesn't apply copy-namespaces="no" for the xsi namespaces in the following example: Saxon 10.2 HE Java with

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""
    <xsl:mode on-no-match="shallow-copy"/>
    <xsl:template match="bar" xpath-default-namespace="">
        <xsl:variable name="bar-copy" as="element()">
            <xsl:copy-of select="." copy-namespaces="no"/>
        <xsl:value-of select="serialize($bar-copy)"/>

when run against the input

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns=""
        <bar xmlns="">test</bar>


<?xml version="1.0" encoding="UTF-8"?><root xmlns="" xmlns:xsi="">
        &lt;bar xmlns="" xmlns:xsi=""&gt;test&lt;/bar&gt;

With Saxon-JS 2/xslt3 the result is

<?xml version="1.0" encoding="UTF-8"?><root xmlns:xsi="" xmlns="">
        &lt;bar xmlns=""&gt;test&lt;/bar&gt;

So the difference is the presence of xmlns:xsi=""&gt;test&lt;/bar&gt; for Saxon Java on the element created with xsl:copy-of copy-namespaces="no".

I see no special treatment prescribed in the XSLT 3 spec for copy-namespaces="no" and the schema instance namespace so Saxon Java's result seems a bug.

Replies (1)

RE: copy-namespaces="no" not honoured for (xsi?) namespace - Added by Michael Kay 10 months ago

Logged here

with a new test case copy-5101.

The particular circumstances causing the problem are (a) Saxon is able to create a virtual copy of the node rather than a physical copy, and (b) the virtual copy is then pushed (decomposed to a set of push events) to a destination such as a serializer.


    Please register to reply