<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="xsl-elements" page="copy" subpage=""/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: xsl:copy</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:copy"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>xsl:copy</h1>
      <p>The <code>xsl:copy</code> element causes the current XML node in the source document to be copied to the
output. The actual effect depends on whether the node is an element, an attribute, or a text node.</p>
      <p>For an element, the start and end element tags are copied; the attributes, character content and child elements
are copied only if <code>xsl:apply-templates</code> is used within <code>xsl:copy</code>.</p>
      <p>Attributes of the generated element can be defined by reference to a named attribute set.
The optional use-attribute-sets attribute contains a white-space-separated list of attribute set names. They
are applied in the order given: if the same attribute is generated more than once, the later value always takes
precedence.</p>
      <p>The following example is a template that copies the input element to the output, together with all its
child elements, character content, and attributes:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>&lt;xsl:template match="*|text()|@*"&gt;
    &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@*"/&gt;
        &lt;xsl:apply-templates/&gt;
    &lt;/xsl:copy&gt;
&lt;/xsl:template&gt;
</code>
         </pre>
      </div>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="copy-of.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>