Re: [xsl] Namespace getting carried over to output XML

Subject: Re: [xsl] Namespace getting carried over to output XML
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Tue, 11 Jul 2006 22:51:52 +0200
Prashanth T S wrote:
Hi,
    I tried to apply a xsl on a xhtml document and once it passes
through the xsl, I am getting the namespace carried over to my output
xhtml document in places unnecessary. Below is an example.

I have given the following line when I start my XSL

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform "
xmlns:xhtml="http://www.w3.org/1999/xhtml " xmlns="
http://www.w3.org/1999/xhtml"; xmlns:abc="abctest"
exclude-result-prefixes="abc">

In the exclude-result-prefixes you should provide the prefixes you *don't* want to have in the result, rather then prefixes bound to namespaces you actually use in the result. Try something like

 <xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:xhtml="http://www.w3.org/1999/xhtml";
 xmlns="http://www.w3.org/1999/xhtml";
 xmlns:abc="abctest"
 exclude-result-prefixes="xhtml">
                          ^^^^^

You should also avoid binding the default namespace if possible.

J.Pietschmann

Current Thread