xsl-list
[Top] [All Lists]

[xsl] exclude-result-prefixes issue

2013-11-06 10:32:32
Hi,

This xslt:

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:aaa="ns"
    xmlns:bbb="ns"
    exclude-result-prefixes="">

    <xsl:output indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/">
        <root>
            <bbb:foo/>
        </root>
    </xsl:template>
</xsl:stylesheet>

produces:

<root xmlns:bbb="ns" xmlns:aaa="ns">
   <bbb:foo/>
</root>

All the namespaces are on the root element as expected.  However if I
modify the xslt to exclude the aaa prefix:

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:aaa="ns"
    xmlns:bbb="ns"
    exclude-result-prefixes="aaa">

    <xsl:output indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/">
        <root>
            <bbb:foo/>
        </root>
    </xsl:template>
</xsl:stylesheet>

the output now becomes:

<root>
   <bbb:foo xmlns:bbb="ns"/>
</root>

Note that bbb namespace has moved from the root element to where it's
used, rather than staying on the root element - it suggests that
exclude-result-prefixes works at the namespace uri level, rather than
the prefix, is that right?

Tested using Saxon HE 9.5.1.3

thanks

-- 
Andrew Welch
http://andrewjwelch.com

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

<Prev in Thread] Current Thread [Next in Thread>