<?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 2011-12-09T20:47:22.916Z--><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 other facet is not satisfied.</p> <p>For example:</p> <div class="codeblock" style="border: solid thin; background-color: #B1CCC7; padding: 2px"> <pre> <code> <xs:element name="date"> <xs:simpleType> <xs:restriction base="xs:date" xmlns:saxon="http://saxon.sf.net/"> <xs:assertion test=". lt current-date()" saxon:message="The date must not be in the future"/> <xs:pattern value="[^Z:]*" saxon:message="The date must not have a timezone"/> </xs:restriction> </xs:simpleType> </xs:element> </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>