From W3C Wiki
Jump to: navigation, search

Grammaticalization of attributes

One of the differences between XML Schema and Relax NG is that while XSD distinguishes sharply between the content model and attribute declarations, which occur in different locations in the complex type definition and follow different rules (e.g. in restrictions).

One way to extend XSD to handle some co-occurrence constraints would be to allow attributes to appear as basic tokens in content models, just as elements can (but with the difference that the location of an attribute declaration in the content model establishes the logical conditions under which the attribute declaration applies but not the location in the document: an attribute declaration occurring between two element references does not mean the attribute must occur between two elements of those types).

In some pages for Co-constraint Use Cases, sample solutions in this style have been provided; they use standard XSD notation, except for allowing 'xsd:attribute' to appear within the content model as well as after it (in which case the declarations are unconditional).