title: xsl:copy-of. Retain original parent node?
body: <p>I've seen plenty of <code>xsl:copy-of</code> examples, such as this one, where the encompassing parent node is hard coded. ie <code>&lt;output&gt;</code> but is there a way to use <code>xsl:copy-of</code> &amp; retain the parent node? <code>&lt;library&gt;</code> in this instance.</p>
  <p>XML:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;library&gt;
      &lt;category name=&quot;dogs&quot;&gt;
          &lt;book&gt;
              &lt;name&gt;All about dogs&lt;/name&gt;
              &lt;author&gt;Someone&lt;/author&gt;
          &lt;/book&gt;
      &lt;/category&gt;
       &lt;category name=&quot;cats&quot;&gt;
          &lt;book&gt;
              &lt;name&gt;All about cats&lt;/name&gt;
              &lt;author&gt;Someone&lt;/author&gt;
          &lt;/book&gt;
      &lt;/category&gt;
  &lt;/library&gt;
  </code></pre>
  <p>XSL:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
      &lt;xsl:template match=&quot;/&quot;&gt;
          &lt;output&gt;
              &lt;xsl:copy-of select=&quot;library/category[@name='cats']&quot; /&gt;
          &lt;/output&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  <p>Current output:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
      &lt;output&gt;
          &lt;category name=&quot;cats&quot;&gt;
              &lt;book&gt;
                  &lt;name&gt;All about cats&lt;/name&gt;
                  &lt;author&gt;Someone&lt;/author&gt;
              &lt;/book&gt;
          &lt;/category&gt;
      &lt;/output&gt;
  </code></pre>