<?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="mode" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:mode</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:mode"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>xsl:mode</h1>
      <p>The <code>xsl:mode</code> declaration is new in XSLT 3.0. Previously, modes were declared implicitly
                  by referring to them in the <code>mode</code> attribute of <code>xsl:template</code> or <code>xsl:apply-templates</code>.
                  XSLT 3.0 introduces an <code>xsl:mode</code> declaration to allow properties of the mode to be defined.</p>
      <p>The element always appears as a child of <code>xsl:stylesheet</code> (or <code>xsl:transform</code>),
                  and it is empty (has no children).</p>
      <p>The <code>name</code> attribute identifies the name of this mode; if omitted, the element describes the properties
                  of the unnamed mode.</p>
      <p>The attribute <code>streamable="yes"</code> indicates that template rules using this mode must be capable
                  of being evaluated in a streaming manner. This imposes restrictions on the content of the template rules.
                  For details, see <a class="bodylink" href="../sourcedocs/streaming.xml">Streaming of Large Documents</a>. This option is available
                  in Saxon-EE only.</p>
      <p>The attribute <code>on-multiple-match</code> indicates what action is taken when a node being processed
                  by <code>xsl:apply-templates</code> in this mode matches more than one template rule (with the same precedence and priority). The values are
                  <code>fail</code> indicating that a dynamic error is reported, or <code>use-last</code> indicating
                  that the template rule appearing last in document order is chosen.</p>
      <p>The attribute <code>on-no-match</code> indicates what action is taken when a node being processed
                  by <code>xsl:apply-templates</code> in this mode matches no template rule. The default value is
                  <code>text-only-copy</code>. The permitted values are:</p>
      <ul>
         <li>
            <p>text-only-copy: the XSLT 2.0 behaviour (for elements: apply-templates to the children;
                        for text nodes: copy the text node to the output)</p>
         </li>
         <li>
            <p>shallow-copy: invoke the "identity template", which copies an element node and does apply-templates
                        to its children</p>
         </li>
         <li>
            <p>deep-copy: invoke <code>xsl:copy-of</code></p>
         </li>
         <li>
            <p>shallow-skip: ignores this node, does apply-templates
                        to its children</p>
         </li>
         <li>
            <p>deep-skip: ignores this node and all its descendants</p>
         </li>
         <li>
            <p>fail: reports a dynamic error</p>
         </li>
      </ul>
      <p>The attribute <code>warning-on-multiple-match="yes"</code> causes a run-time warning when a node is matched
                  by multiple template rules.</p>
      <p>The attribute <code>warning-on-no-match="yes"</code> causes a run-time warning when a node is matched
                  by no template rules.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="namespace.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>