[xsl] superfluous xmlns

Subject: [xsl] superfluous xmlns
From: "Merrilees, David" <David.Merrilees@xxxxxxxxxxxx>
Date: Wed, 12 Oct 2011 09:55:58 +0100
Hi

I don't understand why I'm getting a namespace declaration on nodes in my
output. The input node is in the same namespace (http://www.w3.org/1999/xhtml)
as the output, so why does it end up with an additional
xmlns:view="urn:Tesco.Com.Web.Mvc.View" attribute? Example below.

Input:

<?xml version="1.0" encoding="UTF-8"?>
<view:page xmlns:view="urn:Tesco.Com.Web.Mvc.View" title="Welcome">
        <img xmlns="http://www.w3.org/1999/xhtml";
src="/UIAssets/default/CZ/en-GB/i/home.png" alt=""/>
</view:page>

XSL:

<xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:view="urn:Tesco.Com.Web.Mvc.View"
        xmlns="http://www.w3.org/1999/xhtml";
        exclude-result-prefixes="#all">

        <xsl:template match="/">
                <html xmlns="http://www.w3.org/1999/xhtml";>
                        <xsl:copy-of select="view:page/node()" />
                </html>
        </xsl:template>
</xsl:stylesheet>

Output:

<html xmlns="http://www.w3.org/1999/xhtml";>
        <img xmlns:view="urn:Tesco.Com.Web.Mvc.View"
src="/UIAssets/default/CZ/en-GB/images/paper.png" alt=""/>
</html>

Desired output:

<html xmlns="http://www.w3.org/1999/xhtml";>
        <img src="/UIAssets/default/CZ/en-GB/images/paper.png" alt=""/>
</html>

Thanks

This is a confidential email. Tesco may monitor and record all emails. The
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8
9SL
VAT Registration Number: GB 220 4302 31

Current Thread