xmlxsdxsd-1.1xsd-1.0

XSD "version" attribute semantics


<schema xmlns="http://www.w3.org/2001/XMLSchema" ... version="xxx">

The XSD specification https://www.w3.org/TR/xmlschema11-1/#declare-schema does not specify the semantics for the version attribute:

The other attributes (id and version) are for user convenience, and this specification defines no semantics for them.

Nor does that the W3C versioning guide https://www.w3.org/TR/xmlschema-guide2versioning/.

Is there a consensus arising whether this attribute should be used for specifying the version of the XML Schema document (e.g. 2.3.1), or for the version of the XSD language used to write the schema document (i.e. either 1.0 or 1.1)? Or is the semantics choice still on the designers/developers?


Solution

  • The xs:schema/@version attribute is used for specifying the version of the XSD being developed, not XSD 1.0 vs 1.1. Semantic versioning or any other user-defined semantics may be used. As your apropo quote indicates, it is up to the user to define.

    To specify XSD 1.0 vs 1.1, XSD 1.1 provides conditional inclusion, which can be used on any XSD element, including the xsd:schema root element. For example, an XSD that requires assertions could indicate the need for XSD 1.1 like this:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
               vc:minVersion="1.1">
      <!-- -->
    </xs:schema>