title: XSL - copy elements but remove unused namespace(s)
body: <p>I've got some XML which declares a namespace which is only used for attributes, like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;a xmlns:x="http://tempuri.com"&gt;
      &lt;b&gt;
          &lt;c x:att="true"/&gt;
          &lt;d&gt;hello&lt;/d&gt;
      &lt;/b&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>I want to use XSL to create a copy of selected nodes and their values - getting rid of the attributes. So my desired output is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;b&gt;
      &lt;c /&gt;
      &lt;d&gt;hello&lt;/d&gt;
  &lt;/b&gt;
  </code></pre>
  
  <p>I've got some XSL that almost does this, but I can't seem to stop it putting the namespace declaration in the top level element of the output. My XSL is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
      &lt;xsl:template match="/"&gt;
          &lt;xsl:apply-templates select="/a/b"/&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="node()"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates select="node()"/&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The first element of the output is <code>&lt;b xmlns:x="http://tempuri.com"&gt;</code> instead of <code>&lt;b&gt;</code>. I've tried declaring the namespace in the XSL and putting the prefix in the <code>exclude-result-prefixes</code> list, but this doesn't seem to have any effect. What am I doing wrong?</p>
  
  <p>UPDATE: I've found that by declaring the namespace in the XSL and using the <code>extension-element-prefixes</code> attribute works, but this doesn't seem right! I guess I could use this, but I'd like to know why the <code>exclude-result-prefixes</code> doesn't work!</p>
  
  <p>UPDATE: Actually, it seems this <code>extension-element-prefixes</code> solution only works with XMLSpy's built-in XSLT engine, not with MSXML.</p>