title: XSLT keep namespace on output
body: <p>I need help preserving the namespace on XSLT transformation. I see other threads have solutions, but I don't understand them. When I use the XSLT transformation below, all the namespace disappears. Below is what I'm trying to accomplish. Any help is much appreciated! Thank you!</p>
  
  <p>Before transform XML:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;Worker
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:this="this.file/eib"
      xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
      xmlns:tv="java:com.workday.esb.intsys.TypedValue"&gt;
      &lt;Detail&gt;
          &lt;EmployeeID&gt;123456&lt;/EmployeeID&gt;
          &lt;PayCode&gt;Earning&lt;/PayCode&gt;
          &lt;Amount&gt;4243.20&lt;/Amount&gt;
      &lt;/Detail&gt;
      &lt;Detail&gt;
          &lt;EmployeeID&gt;123456&lt;/EmployeeID&gt;
          &lt;PayCode&gt;Deduction&lt;/PayCode&gt;
          &lt;Amount&gt;2265.60&lt;/Amount&gt;
      &lt;/Detail&gt;
  &lt;/Worker&gt;
  </code></pre>
  
  <p>My XSLT transformation:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="2.0" exclude-result-prefixes="xsl wd is xsd this env"
      xmlns:wd="urn:com.workday/bsvc" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:this="urn:this-stylesheet"&gt;
  
      &lt;xsl:output indent="yes" method="xml"/&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;xsl:copy&gt;
              &lt;Worker&gt;
                  &lt;xsl:for-each select="Worker" &gt;
                      &lt;Detail&gt;
                          &lt;EmployeeID&gt;&lt;xsl:value-of select="Detail[(PayCode ='Earning')]/EmployeeID"/&gt;&lt;/EmployeeID&gt;
                          &lt;PayCode&gt;&lt;xsl:value-of select="Detail[(PayCode ='Earning')]/PayCode"/&gt;&lt;/PayCode&gt;
                          &lt;Amount&gt;&lt;xsl:value-of select="Detail[(PayCode ='Earning') and (string-length(Amount) &gt; 0)]/Amount"/&gt;&lt;/Amount&gt;
                      &lt;/Detail&gt;
                  &lt;/xsl:for-each&gt;
              &lt;/Worker&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Worker
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:this="this.file/eib"
      xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
      xmlns:tv="java:com.workday.esb.intsys.TypedValue"&gt;
     &lt;Detail&gt;
        &lt;EmployeeID&gt;123456&lt;/EmployeeID&gt;
        &lt;PayCode&gt;Earning&lt;/PayCode&gt;
        &lt;Amount&gt;4243.20&lt;/Amount&gt;
     &lt;/Detail&gt;
  &lt;/Worker&gt;
  </code></pre>