# XML Schema 1.1

Saxon includes an almost complete implementation of the proposed specification of XML Schema 1.1.

This support is generally provided only if explicitly requested by using the -xsdversion:1.1 option on the command line, or equivalent options in the API.

The rules for valid type derivation follow the XML Schema 1.1 specification, regardless of this option setting. This is because the rules in the 1.0 specification do not meet the stated intent, namely that type derivation is valid in all cases where the restricted type allows a subset of the instances permitted by the base type.

Some of the changes implemented for XSD 1.1 are as follows:

- The rules for valid restrictions of complex types have changed: the specification now defines these rules in a very similar way to the way that Saxon has always implemented.

- Assertions are implemented, on both complex types and simple types. Saxon allows the full syntax of XPath 2.0 to be used in assertions. In the case of complex types, the context item is currently set to the element node being validated as an untyped tree (according to the specification, all nodes except the root of the tree should be typed). For simple types, and for complex types with simple content, the typed value of the node is available as the value of the variable `$value`. This is currently typed as an instance of the base type (the type being restricted by the assertion), not the nearest built-in type as specified by W3C.

- Conditional Type Assignment (`xs:alternative`) is implemented. Again the full syntax of XPath 2.0 is allowed. (Currently however the rules for type subsumption are not checked). The XPath condition used to select a type alternative can access attributes on ancestor elements provided they are declared as `inheritable`.

- Unrestricted `minOccurs` and `maxOccurs` values are allowed on the element particles within `xs:all` groups.

- An `xs:all` content model may now be derived by extension from another `xs:all` content model.

- An `xs:all` content model may use an `xs:group` element to refer to a named model group containing another `xs:all` content model.

- Element wildcards (`xs:any`) are allowed within `xs:all` groups.

- The `notNamespace` and `notQName` attributes are now supported on `xs:any` and `xs:anyAttribute` wildcards, including (from Saxon 9.3) `notQName="##defined"` and `notQName="##definedSibling"/>`

- The `targetNamespace` attribute is available for use on local element and attribute declarations appearing within the restriction of a complex type.

- Open content is implemented.

- The `defaultAttributes` attribute of `xs:schema` is implemented

- Saxon allows conditional inclusion of elements in a schema document, using attributes such as `vc:minVersion` and `vc:maxVersion`. This feature is available whether the schema processor is run in 1.0 or 1.1 mode, allowing new 1.1 features such as assertions to be ignored when running in 1.0 mode.

- The type `xs:error` is implemented.

- An element may now appear in more than one substitution group.

- A new facet `xs:explicitTimezone` is available with values `required`, `optional`, or `prohibited`.

- The new built-in data type `xs:dateTimeStamp` (an `xs:dateTime` with timezone required) is implemented.

- The new primitive type xs:precisionDecimal. Validation of this type is implemented, plus enough comparison and arithmetic logic to support creating of facets in the schema; however the full semantics of xs:precisionDecimal in XPath and XQuery are not currently defined.

- The `xs:override` declaration is implemented. There are a couple of known restrictions: circular `xs:override` chains are not allowed, and the interaction of `xs:override` with `xs:redefine` is untested.

- Multiple ID attributes are allowed on an element; ID and IDREF values appearing within a simple type constructed from ID by list and union (as well as restriction) are recognized.

- The `notQName=##definedSibling` option in element wildcards is available.

Unimplemented Features

The following facilities are not implemented. This list may be incomplete.

- The so-called "dynamic element declarations consistent" constraint: specifically, the rule that if a wildcard matches an element or attribute with a global declaration, then the global declaration must have a type that is consistent with any locally-declared elements or attributes having the same name.

- Assertions: the data presented to an assertion on a complex type is currently untyped.

- There are new rules indicating what should happen when the XPath expressions in an identity contraint select nodes in a part of the document that is skipped.

Next