Tamino XML Server Version 9.7
 —  Tamino XML Schema Reference Guide  —

xs:restriction

Purpose This element allows restrictions to be imposed on the datatype specified by the base attribute. You can choose between twelve constraining facets, which are listed below in the child elements section of this table.
Parent element xs:complexContent, xs:simpleType
Child elements

xs:enumeration, xs:fractionDigits, xs:length, xs:maxExclusive, xs:maxInclusive, xs:maxLength, xs:minExclusive, xs:minInclusive, xs:minLength, xs:pattern, xs:totalDigits, xs:whiteSpace.

These child elements represent the constraining facets that can be applied to restrict the value space of the new data type to be defined.

Attributes base
Attributes
Name Type Description
base xs:QName When you use the xs:restriction element to derive a new simple type from an existing simple type (the base type), the base attribute specifies the type from which the derived type is derived. See the example below in which a new type is derived from xs:NMTOKEN by restriction.

Example 1

This example shows a type definition of an enumeration type whose lexical space contains the three values given as value arguments for the xs:enumeration element:

<xs:restriction base = "xs:NMTOKEN">
  <xs:enumeration value = "instrumentalist"/>
  <xs:enumeration value = "jazzSinger"/>
  <xs:enumeration value = "jazzComposer"/>
</xs:restriction>

Example 2

This example defines a datatype for a financial application for expressing numerical values for monetary amounts ranging from -999,999,999.99 Euros to 999,999,999.99 Euros:

<xs:simpleType name="amount">
  <xs:restriction base="xs:decimal">
    <xs:totalDigits value="11"/>
    <xs:fractionDigits value="2"/>
  </xs:restriction>
</xs:simpleType>

Top of page