<?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="patterns" subpage=""/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: XSLT Patterns</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: XSLT Patterns"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>XSLT Patterns</h1>
      <p>This section gives an informal description of the syntax of XSLT patterns.
For a formal specification, see the XSLT recommendation. Pattern syntax has not
changed significantly in XSLT 2.0, except that any XPath 2.0 expression may now
be used within a predicate.</p>
      <p>Patterns define a condition that a node may or may not satisfy: a node either matches the
pattern, or it does not. The syntax of patterns is a subset of that for
the <a class="bodylink" href="../expressions/intro.xml">XPath expressions</a>, and formally, a node matches
a pattern if it is a member of the node set selected by the corresponding expression, with
some ancestor of the node acting as the current node for evaluating the expression. For example
a TITLE node matches the pattern "TITLE" because it is a member of the node set selected by the
expression "TITLE" when evaluated at the immediate parent node.</p>
      <p>In XSLT stylesheets, patterns are used primarily in the <code>match</code> attribute of the 
<code>xsl:template</code> element.
They are also used in the <code>count</code> and <code>from</code> attributes of <code>xsl:number</code>, the
<code>match</code> attribute of <code>xsl:key</code>, and the <code>group-starting-with</code> and <code>group-ending-with</code>
attributes of <code>xsl:for-each-group</code>.</p>
      <p>The next page gives some examples of match patterns and their meaning, and this is followed
by a page that gives a summary of the syntax.</p>
      <ul>
         <li>
            <p><a class="bodylink" href="patterns/examples.xml">Examples of Patterns</a></p>
         </li>
         <li>
            <p><a class="bodylink" href="patterns/syntax.xml">Pattern syntax</a></p>
         </li>
      </ul>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="patterns/examples.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>