<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="schema-processing" page="extensions11" subpage="saxon.message"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: Messages associated with assertions and other facets</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Messages associated with assertions and other facets"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Messages associated with assertions and other facets</h1>
      <p>In assertions, and on all elements representing facets (for example <code>pattern</code>), 
Saxon supports the attribute <code>saxon:message="message text"</code>.
This message text is used in error messages when the assertion or facet is not satisfied.</p>
      <p>For example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
  &lt;xs:element name="date"&gt;
    &lt;xs:simpleType&gt;
       &lt;xs:restriction base="xs:date" xmlns:saxon="http://saxon.sf.net/"&gt;
         &lt;xs:assert test=". lt current-date()"
                    saxon:message="The date must not be in the future"/&gt;
         &lt;xs:pattern value="[^Z:]*" 
                    saxon:message="The date must not have a timezone"/&gt;
       &lt;/xs:restriction&gt;   
    &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
</code>
         </pre>
      </div>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="preprocess.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>