The saxon:distinct facet

This facet can be used only on list types. If the facet is present, it constrains the values in the list to be distinct. That is, no item in the list may be equal to a different item in the list. Equality is defined by the schema equality rules (which are not the same as the XPath equality rules: for example an xs:double is never equal to an xs:integer). Values that are not comparable (for example an integer and a date) are considered distinct.

The facet may be written either as <saxon:distinct value="true"/> or more simply <saxon:distinct/>. The only permitted value for the value attribute is "true".

If the facet is present on a type, then it is also implicitly present on all types derived by restriction.

For example, a list of days-of-the-week, not permitting duplicates, might be written:

<xs:simpleType name="days"> <xs:restriction> <xs:list> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Mon"/> <xs:enumeration value="Tues"/> <xs:enumeration value="Weds"/> <xs:enumeration value="Thurs"/> <xs:enumeration value="Fri"/> <xs:enumeration value="Sat"/> <xs:enumeration value="Sun"/> </xs:restriction> </xs:simpleType> </xs:list> <saxon:distinct xmlns:saxon="http://saxon.sf.net/"/> </xs:restriction> </xs:simpleType>