title: XSLT copy text before childs and transform childs
body: <p>I'm trying to take this XML</p>
  
  <pre><code>&lt;tag&gt;text before childs
      &lt;child1 attr="value"/&gt;
      &lt;child2 attr="value"/&gt;
      text after childs
  &lt;/tag&gt;
  </code></pre>
  
  <p>I have a template for <code>child1</code> and <code>child2</code> that looks like this</p>
  
  <pre><code>&lt;xsl:template match="child1"&gt;
      GOOFY
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;xsl:template match="child2"&gt;
      DONALDDUCK
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I want to transform the XML in something like</p>
  
  <pre><code>&lt;tag&gt; 
    text before childs GOOFY DONALDDUCK text after childs  
  &lt;/tag&gt;
  </code></pre>
  
  <p>Following the advice of michael.hor257k I've tryied using an identity template like this</p>
  
  <pre><code>&lt;xsl:template match="tag"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates select="child1"/&gt;
              &lt;xsl:apply-templates select="child2"/&gt;
          &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>but as a result I get</p>
  
  <pre><code>&lt;tag/&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;tag&gt;GOOFY DONALDDUCK&lt;/tag&gt;
  </code></pre>