title: How to remove one specific namespace from XML element
body: <p>I have looked for this specific case, but have not found. I have this XML, that has other elements besides those three, but they are irrelevant. Relevant elements have two namespaces attached to it. I want to remove xmlns:two so in the output only first xmlns is present.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Header&gt;
      &lt;one:id xmlns:one="http://x.com/xsd/so" 
          xmlns:two="http://x.com/xsd/woa.xsd"&gt;555&lt;/one:id&gt;
      &lt;one:protocolVersion xmlns:one="http://x.com/xsd/so" 
          xmlns:two="http://x.com/xsd/woa.xsd"&gt;2.0&lt;/one:protocolVersion&gt;
      &lt;one:userId xmlns:one="http://x.com/xsd/so" 
          xmlns:two="http://x.com/xsd/woa.xsd"&gt;12345&lt;/one:userId&gt;
  &lt;/Header&gt;
  </code></pre>
  
  <p>Now what I want, is to remove xmlns:two</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Header&gt;
      &lt;one:id xmlns:one="http://x.com/xsd/so"&gt;555&lt;/one:id&gt;
      &lt;one:protocolVersion xmlns:one="http://x.com/xsd/so"&gt;2.0&lt;/one:protocolVersion&gt;
      &lt;one:userId xmlns:one="http://x.com/xsd/so"&gt;12345&lt;/one:userId&gt;
  &lt;/Header&gt;
  </code></pre>
  
  <p>I have tried something like this, but it removes wrong namespace. It removes same namespace that is prefix.</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:two="http://x.com/xsd/woa.xsd" 
      xmlns:one="http://x.com/xsd/so"&gt;
      &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt;
      &lt;xsl:strip-space elements="*"/&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:template match="one:id"&gt;
          &lt;xsl:element name="{local-name()}"&gt;
              &lt;xsl:copy-of select="namespace::*[not(. = namespace-uri(..))]"/&gt;
              &lt;xsl:apply-templates select="node()|@*"/&gt;
          &lt;/xsl:element&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>