title: Selecting node values from a SOAP message using XSLT
body: <p>I'm trying to get values from a SOAP message. I need to to retrieve the username and password.</p>
  
  <p>The SOAP message looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
    &lt;soap:Header&gt;&lt;/soap:Header&gt;
    &lt;soap:Body&gt;    
       &lt;GetData xmlns="http://webservicedata.com/"&gt;   
        &lt;oXmlElement&gt;
          &lt;message&gt;
            &lt;header&gt;
              &lt;username&gt;test@gmail.com&lt;/username&gt;
              &lt;password&gt;Test password&lt;/password&gt;
            &lt;/header&gt;
          &lt;/message&gt;
        &lt;/oXmlElement&gt;
      &lt;/GetData&gt;    
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>This is my XSLT</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" exclude-result-prefixes="soap msxsl"&gt;
    &lt;xsl:output method="xml" indent="yes"/&gt;
    &lt;xsl:template match="/"&gt;
      &lt;NewDataSet&gt;
        &lt;Header&gt;           
          &lt;username&gt;
            &lt;xsl:value-of select="soap:Envelope/soap:Body/GetData/oXmlElement/message/header/username"/&gt;
          &lt;/username&gt;
          &lt;password&gt;
            &lt;xsl:value-of select="soap:Envelope/soap:Body/GetDate/oXmlElement/message/header/password"/&gt;
          &lt;/password&gt;
        &lt;/Header&gt;
      &lt;/NewDataSet&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Below is the desired result which works if I remove <code>&lt;GetData xmlns="http://webservicedata.com/"&gt;</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;NewDataSet&gt;
     &lt;Header&gt;
        &lt;Portfolio /&gt;
        &lt;username&gt;test@gmail.com&lt;/username&gt;
        &lt;password&gt;testpassword&lt;/password&gt;
     &lt;/Header&gt;
  &lt;/NewDataSet&gt;
  </code></pre>