Restriction is done using the general facets, or the following atomic facets (they must be available for the base type).
These facets are defined in XML Schema 1.1. For convenience, the summary from the XML Schema 1.1 specification is provided below. Which primitive type has which facets is defined in XML Schema 1.1 as well.
The following atomic facets are available for the primitive types string, anyURI, base64Binary, hexBinary:
$length (integer): Constraining a value space to values with a specific number of units of length, where units of length varies depending on the base type.
$minLength (integer): Constraining a value space to values with at least a specific number of units of length, where units of length varies depending on the base type.
$maxLength (integer): Constraining a value space to values with at most a specific number of units of length, where units of length varies depending on the base type.
The following atomic facets are available for the primitive types date, dateTime, time, gYear, gYearMonth, gMonth, gMonthDay, gDay, duration, decimal, double, float:
$maxInclusive (atomic): Constraining a value space to values with a specific inclusive upper bound.
$maxExclusive (atomic): Constraining a value space to values with a specific exclusive upper bound.
$minExclusive (atomic): Constraining a value space to values with a specific exclusive lower bound.
$minInclusive (atomic): Constraining a value space to values with a specific inclusive lower bound.
The following atomic facets are available for the primitive type decimal:
$totalDigits (integer): Restricting the magnitude and arithmetic precision of values in the value spaces of decimal and datatypes derived from it.
$fractionDigits (integer): Placing an upper limit on the arithmetic precision of decimal values.
The following atomic facets are available for the primitive types date, dateTime, time:
$explicitTimezone ("required", "prohibited" or "optional"): Requiring or prohibiting the time zone offset in date/time datatypes.
The following atomic facets are available for all primitive types (including boolean and null):
$pattern (string): Constraining a value space to values that are denoted by literals which match each of a set of regular expressions.