title: Namespace Trouble in XML Documents for SOAP Requests
body: <p>I am consuming a soap webservice as a client. For generating the SOAP-Requests documents i am using XSLT.</p>
  
  <p>Lets imagine i want to call the SOAP-Action "getNumber", i'll render the following document:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abc="xyz"&gt;
  &lt;soapenv:Header /&gt;
  &lt;soapenv:Body&gt;
      &lt;abc:getNumber&gt;
          &lt;abc:param1&gt;123&lt;/abc:param1&gt;
      &lt;/abc:getNumber&gt;
  &lt;/soapenv:Body&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see, the namespace is correctly defined in the Envelope-Tag. When i sent this xml to the webservice, the parser on the other side gives an error because the namespace is (for me obviously not) missing.</p>
  
  <p>If i ask the support of the webservice they say, i have to put the namespace on the method like</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;soapenv:Header /&gt;
      &lt;soapenv:Body&gt;
          &lt;abc:getNumber xmlns:abc="xyz"&gt;
              &lt;abc:param1&gt;123&lt;/abc:param1&gt;
          &lt;/abc:getNumber&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I dont understand why and they cant give me a reasonable explanation.</p>
  
  <p>For me its a good style to define the namespaces on a central place, like in the "xsl:stylesheet"-Tag, so i have to define it once and use it everywhere in the stylesheet.</p>
  
  <p>If i make it like they want, i have to write it to at least 7 or 8 places in the stylesheet, because i am using several templates to render the single parts of the document and on every template i have to write all the namespace declarations again.</p>
  
  <p>My guess is, that their (one of a very well known) framework is not good enough to extract a XML Fragment properly from the whole XML-Document.
  It will only cut out the node "abc:getNumber" and threat it as a new XML-Document and will suddenly notice, that there is no namespace defined.</p>
  
  <p>First Question: Am I right with my assumption? Are the (well known) Frameworks for SOAP-Processing to bad to get this?</p>
  
  <p>Second Question: Does anybody know a trick to influence the appearance of XML-Namespaces in XSL without writing them again and again to the single templates i use?</p>