title: How to remove the unwanted empty xmlns in xml output from xslt
body: <p>I am trying to build a Soap request. The desired output is:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"   
  xmlns:soap1="http://acme.com/ws/soapheaders"&gt;
  &lt;soap:Header&gt;
      &lt;soap1:locale&gt;en&lt;/soap1:locale&gt;
      &lt;soap1:authentication&gt;
          &lt;soap1:username&gt;john.doe&lt;/soap1:username&gt;
          &lt;soap1:password&gt;psw&lt;/soap1:password&gt;
      &lt;/soap1:authentication&gt;
  &lt;/soap:Header&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is my testing xsl (lanuage, username and password will be passed in real application):</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:output method="xml" omit-xml-declaration="yes" indent="yes"/&gt;
  &lt;xsl:param name="language" select="'en'"/&gt;
  &lt;xsl:param name="username" select="'john.doe'"/&gt;
  &lt;xsl:param name="password" select="'psw'"/&gt;
  &lt;xsl:template match="/"&gt;
      &lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
          xmlns:soap1="http://acme.com/ws/soapheaders" &gt;
          &lt;xsl:call-template name="soapHeader"/&gt;              
          &lt;xsl:call-template name="soapBody"/&gt;
      &lt;/soap:Envelope&gt;
  &lt;/xsl:template&gt;
  &lt;xsl:template name="soapHeader"&gt;
      &lt;soap:Header&gt; 
          &lt;soap1:locale&gt;&lt;xsl:value-of select="$language" /&gt;&lt;/soap1:locale&gt;
          &lt;soap1:authentication&gt;
              &lt;soap1:username&gt;&lt;xsl:value-of select="$username" /&gt;&lt;/soap1:username&gt;
              &lt;soap1:password&gt;&lt;xsl:value-of select="$password" /&gt;&lt;/soap1:password&gt;
          &lt;/soap1:authentication&gt;
      &lt;/soap:Header&gt; 
  &lt;/xsl:template&gt;
  &lt;xsl:template name="soapBody"&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>However, the output is:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://acme.com/ws/soapheaders"&gt;
  &lt;soap:Header xmlns:soap=""&gt;
      &lt;soap1:locale xmlns:soap1=""&gt;en&lt;/soap1:locale&gt;
      &lt;soap1:authentication xmlns:soap1=""&gt;
          &lt;soap1:username&gt;john.doe&lt;/soap1:username&gt;
          &lt;soap1:password&gt;psw&lt;/soap1:password&gt;
      &lt;/soap1:authentication&gt;
  &lt;/soap:Header&gt;
  </code></pre>
  
  <p></p>
  
  <p>There are unwanted empty namespaces, such as xmlns:soap="", xmlns:soap1="".  Can you point me to right directions to eliminate these unwanted artifacts?</p>
  
  <p>Thanks.</p>