title: XSLT Transformation of SOAP message content
body: <p>I have this XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;SOAP-ENV:Header/&gt;
      &lt;S:Body&gt;
          &lt;ns2:wordList xmlns:ns2="http://service/"&gt;
              &lt;prefix1&gt;b&lt;/prefix1&gt;
              &lt;prefix2&gt;a&lt;/prefix2&gt;
          &lt;/ns2:wordList&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>I want to transform this file to:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;SOAP-ENV:Header/&gt;
      &lt;S:Body&gt;
          &lt;ns2:wordList xmlns:ns2="http://service/"&gt;
              &lt;pre1&gt;b&lt;/pre1&gt;
              &lt;pre2&gt;a&lt;/pre2&gt;
          &lt;/ns2:wordList&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>However what I get is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  
  
              &lt;pre1 xmlns:ns2="http://ws/"&gt;b&lt;/pre1&gt;
              &lt;pre2 xmlns:ns2="http://ws/"&gt;a&lt;/pre2&gt;
  </code></pre>
  
  <p>My transformation:</p>
  
  <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:ns2="http://ws/"
                  version="1.0"&gt;
      &lt;xsl:output method="xml"/&gt;
  
  
      &lt;xsl:template match="/"&gt;
          &lt;xsl:apply-templates/&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="ns2:wordList"&gt;
          &lt;ns2:wordList xmlns:ns2="http://ws/"&gt;
          &lt;xsl:apply-templates/&gt;
          &lt;/ns2:wordList&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="pre1|prefix1"&gt;
          &lt;pre1&gt;
              &lt;xsl:value-of select="."/&gt;
          &lt;/pre1&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="pre2|prefix2"&gt;
          &lt;pre2&gt;
              &lt;xsl:value-of select="."/&gt;
          &lt;/pre2&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Why do I lose almost all information? I would think XSL transformation would just copy all elements that are not specified by a certain template, but instead everything seems to get lost apart from the information contained withing the "pre" templates.</p>