title: Namespace is applied to child elements
body: <p>I have the following input(excluding full file for brevity):</p>
  
  <p><b>input.xml</b></p>
  
  <pre><code>&lt;Request&gt;
      &lt;EFS&gt;
          &lt;child1&gt;
              &lt;!-- children --&gt;
          &lt;/child1&gt;
          &lt;child2&gt;
  
          &lt;/child2&gt;
      &lt;!-- more children etc--&gt;
      &lt;/EFS&gt;
  &lt;/Request&gt;
  </code></pre>
  
  <p>I want to remove the <code>&lt;Request&gt;</code> element, so <code>&lt;EFS&gt;</code> becomes the new root element, and then I want to add the namespace to it. My XSL is as follows(also shortened):</p>
  
  <p><b>my-stylesheet.xsl</b></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"  version="2.0"&gt; 
  &lt;xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"/&gt;
  &lt;xsl:strip-space elements="*" /&gt;
  
  &lt;xsl:template match="@*|node()" name="identity"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:copy-of select="@*" copy-namespaces="no" /&gt;
          &lt;xsl:apply-templates select="@*|node()" /&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="/*"&gt;
      &lt;xsl:apply-templates select="node()" /&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="EFS"&gt;
     &lt;xsl:element name="EFS" xmlns="'http://www.EFS-standards.org/standards/PC_Surety/EFS1.6.12/xml/Intake'"&gt;
         &lt;xsl:call-template name="createEFScontent"/&gt;
         &lt;xsl:apply-templates/&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="createEFScontent"&gt;
          &lt;xsl:element name="AuditTotal"&gt;
              &lt;xsl:element name="TransmissionID" /&gt;
              &lt;xsl:element name="MessageQuantity" /&gt;
              &lt;xsl:element name="TotalAmt"&gt;0.00&lt;/xsl:element&gt;
          &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;!-- rest of stylesheet --&gt;
  </code></pre>
  
  <p>So  <code>&lt;Request&gt;</code> is removed and <code>&lt;EFS&gt;</code> becomes the new root. After this I'm applying a namespace to <code>&lt;EFS&gt;</code> and the output looks as follows:</p>
  
  <p><b>output.xml</b></p>
  
  <pre><code>&lt;EFS xmlns="'http://www.EFS-standards.org/standards/PC_Surety/EFS1.6.12/xml/Intake'"&gt;
     &lt;AuditTotal xmlns=""&gt;
        &lt;TransmissionID/&gt;
        &lt;MessageQuantity/&gt;
        &lt;TotalAmt&gt;0.00&lt;/com.LibertyMutual_TotalAmt&gt;
     &lt;/AuditTotal&gt;
     &lt;child1 xmlns=""&gt;
        //children
     &lt;/child1&gt;
     &lt;child2 xmlns=""&gt;
         &lt;!-- children --&gt;
     &lt;/child2&gt;
     &lt;!-- rest of output --&gt;
  </code></pre>
  
  <p>I'm not sure whats going wrong. I want the output to look as it does now without xmlns="" on child 1 and 2. Do I need to add another template to strip these out? Am I making a mistake in the templates listed?</p>
  
  <p>I'm using SaxonHE 9.7.0-8, and this is called from within a Camel route in a transform step(if that makes any difference). Also worth noting, it only applies the blank namespace to child 1 and 2 elements. There are no other children of EFS, but the child elements of child1 and child2 do not have the xmlns=""</p>
  
  <p>EDIT: Following Tim C's answer, I have replaced the Identity template with his and added the template:</p>
  
  <pre><code>&lt;xsl:template match="@*|text()|comment()|processing-instruction()"&gt;
      &lt;xsl:copy /&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>This applies the namespace to EFS. The namespaces either appear blank on some elelements or with the full namespace value when I add a template like the following:</p>
  
  <pre><code>    &lt;xsl:template match="EFS/child1/AddRq/Policy"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:element name="RDDCd"&gt;
              &lt;xsl:call-template name="getRDDCd" /&gt;
          &lt;/xsl:element&gt;
          &lt;xsl:apply-templates select="node()"/&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>When this runs, Policy will be output with xmlns="" and RDDCd(along with an existing child element of Policy) will contain xmlns=</p>
  
  <p>There are quite a  few of these templates in the xsl; Im trying to copy the existing content of the matched element, and add a new one, then return to the identity template( I think, I'm not great with xsl). Is there something I'm doing glaringly wrong? Most of my tempaltes are matchign to elements in the source, copying the contents over and adding a new child(covers around 70% of the templates in the stylesheet). As mentioned, I've been creating these templates in the fashion of the one above, with the rest being element removal:</p>
  
  <pre><code>&lt;template match="MSDCd" /&gt;
  </code></pre>
  
  <p>Or changing the value of an element/child of elements.</p>