4
<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?

xarx
  • 627
  • 1
  • 11
  • 27

1 Answers1

5

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>
kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • This is what I thought too, but when I was searching on the web, I found several links like [this one](http://wiki.archive.iatistandard.org/standard/revision/1.03/changes_specification#add_a_schema_version_attribute_to_the_root_element), but none explicitly supporting my view. Which caused me to ask the question. – xarx May 27 '17 at 16:01
  • That [link](http://wiki.archive.iatistandard.org/standard/revision/1.03/changes_specification#add_a_schema_version_attribute_to_the_root_element) also supports your view. The *standard* to which they recommend use of `xs:schema/@version` refers to their [**IATI standard**](http://wiki.archive.iatistandard.org/standard/start), *not* to the W3C XML Schema standard. – kjhughes May 27 '17 at 19:12