In assertions, and on all elements representing facets (for example pattern
),
Saxon supports the attribute saxon:message="message text"
.
This message text is used in error messages when the assertion or facet is not satisfied.
For example:
<xs:element name="date">
<xs:simpleType>
<xs:restriction base="xs:date" xmlns:saxon="http://saxon.sf.net/">
<xs:assert 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>