Black Mesa Technologies LLC

What is VC-Filter?

XSD 1.1 (that is, version 1.1 of the “XML Schema Definition Language” defined by the World Wide Web Consortium) defines several attributes in a ‘version-control” namespace (VC) for use in XSD schema documents, to allow the same schema document to be used with schema processors supporting different versions of XSD.

VC-Filter uses an XSLT stylesheet to illustrate the principle. You can use it to experiment with different formulations and conditions, to see how the conditional-inclusion mechanism of the VC namespace works.

The stylesheet xsd.vc.xsl (which you can download and use locally if you wish) reads the document on the left, filters it according to the rules specified in the XSD 1.1 spec, and displays the result on the right.

The VC attributes

The VC namespace has six attributes, which W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures (aka ‘the Schema spec’) defines as having the following meanings. Each attribute effectively defines a test, which succeeds or fails. Any element which fails any of the tests specified on it is filtered out of the schema document before the validator actually works on it. Each test involves comparing the value of the attribute against (a) the version number of the version of XSD supported by the processor (e.g. 1.0, 1.1, ...), (b) the names of the datatypes automatically provided by the processor (i.e. the built-in types, plus any implementation-defined types which are automatically included), and (c) the names of facets automatically provided by the processor.

vc:minVersion

Specifies a decimal number. Succeeds if the XSD version supported by the processor is greater than or equal to vc:minVersion.

E.g. for a 1.1 processor, vc:minVersion="1.1" succeeds, and vc:minVersion="1.2" fails. (Note that minVersion applies an inclusive test.)

vc:maxVersion

Specifies a decimal number. Succeeds if the XSD version supported by the processor is less than vc:maxVersion.

E.g. for a 1.1 processor, vc:maxVersion="1.1" fails (“less than”, I said, not “less than or equal to”), and vc:maxVersion="1.2" succeeds. (Note that maxVersion applies an exclusive test.)

vc:typeAvailable

Specifies a list of QNames. Succeeds if all the QNames in the value are supported by the processor and made available automatically (as built-ins or as implementation-defined built-ins).

E.g. for a processor which supports only the built-in datatypes, vc:typeAvailable="xs:decimal xs:anyURI" succeeds and vc:typeAvailable="xs:decimal rdf:text" fails.

vc:typeUnavailable

Specifies a list of QNames. Succeeds if any of the QNames in the value are unavailable as automatically available (built-in) datatypes in this processor.

E.g. for a processor which supports only the built-in datatypes, vc:typeUnavailable="xs:decimal xs:anyURI" fails and vc:typeUnavailable="xs:decimal rdf:text" succeeds.

vc:facetAvailable

Specifies a list of QNames. Succeeds if all the QNames in the value are supported by the processor as facets for the definition of new simple types.

E.g. for a processor which supports only the built-in facets, vc:facetAvailable="xs:minInclusive xs:pattern" succeeds and vc:facetAvailable="xs:minInclusive rdf:langRange" fails.

vc:facetUnavailable

Specifies a list of QNames. Succeeds if any of the QNames in the value are unavailable as automatically available (built-in) datafacets in this processor.

E.g. for a processor which supports only the built-in datafacets, vc:facetUnavailable="xs:minInclusive xs:pattern" fails and vc:facetUnavailable="xs:minInclusive rdf:langRange" succeeds.

Parameters

VC-Filter supports three parameters, to enable it to be used to experiment with different assumptions about the target processor (or: to filter schema documents for different target processors):

version number

The version number of the target processor. This is the number that gets compared to the values of the vc:minVersion and vc:maxVersion attributes.

Default: 1.1

additional datatypes

Expanded names of datatypes which should be assumed to be built in to the processor and thus automatically available. This list, plus the list of the built-in datatypes defined by XSD 1.1, is used to determine whether the vc:typeAvailable and vc:typeUnavailable attributes succeed or fail.

The value should take the form of a white-space delimited list of expanded names of the form “{nsname}localname”.

Default: “{http://www.w3.org/1999/02/22-rdf-syntax-ns}text

additional facets

Expanded names of facets which should be assumed to be built in to the processor and thus automatically available. This list, plus the list of the built-in facets defined by XSD 1.1, is used to determine whether the vc:facetAvailable and vc:facetUnavailable attributes succeed or fail.

The value should take the form of a white-space delimited list of expanded names of the form “{nsname}localname”.

Default: “{http://www.w3.org/1999/02/22-rdf-syntax-ns}langRange

Gaps, shortcomings, bugs

The known problems with VC-Filter are listed here.