[Bug 5674] substitution groups for attributes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5674

           Summary: substitution groups for attributes
           Product: XML Schema
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Structures: XSD Part 1
        AssignedTo: cmsmcq@w3.org
        ReportedBy: pmarinel@cs.unibo.it
         QAContact: www-xml-schema-comments@w3.org


Dear all,
  one of the most interesting and powerful feature of XSDL (both 1.0 and 1.1)
is represented by substitution groups. Unfortunately, substitution groups apply
to element only, and not to attributes. 

Extending substitution groups to attributes would allow, e.g., to write
complete "localized" form of XML vocabularies, as suggested by the example
below, and as discussed in [1].

<!--================================-->
<!-- ABSTRACT VOCABULARY DEFINITION -->
<!--================================-->

<xs:element name="abstractPerson" type="abstractPersonType" abstract="true" />
<xs:complexType name="abstractPersonType" abstract="true">
  <xs:sequence>
    ...
  </xs:sequence>
  <xs:attribute ref="abstractTitle" />
</xs:complexType>

<xs:attribute name="abstractTitle" type="abstractTitleType" abstract="true" />
<xs:simpleType name="abstractTitleType">
  <xs:restriction base="xs:token" />
</xs:simpleType>

<!--===============================-->
<!-- ENGLISH VOCABULARY DEFINITION -->
<!--===============================-->

<!-- inlcude the abstract vocabulary definition -->

<xs:element name="person" type="personType" substitutionGroup="abstractPerson"
/>
<xs:complexType name="personType">
  <xs:complexContent>
    <xs:restriction base="abstractPersonType">
      <xs:sequence>
              ...
      </xs:sequence>
      <xs:attribute ref="title" />
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

<xs:attribute name="title" type="titleType" substitutionGroup="abstractTitle"
/>
<xs:simpleType name="titleType">
  <xs:restriction base="abstractTitleType">
    <xs:enumeration value="Mr" />
    <xs:enumeration value="Mrs" />
    <xs:enumeration value="Dr" />
  </xs:restriction>
</xs:simpleType>

<!--===============================-->
<!-- ITALIAN VOCABULARY DEFINITION -->
<!--===============================-->

<!-- inlcude the abstract vocabulary definition -->

<xs:element name="persona" type="personaType"
substitutionGroup="abstractPerson" />
<xs:complexType name="personaType">
  <xs:complexContent>
    <xs:restriction base="abstractPersonType">
      <xs:sequence>
        ...
      </xs:sequence>
      <xs:attribute ref="titolo" />
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

<xs:attribute name="titolo" type="titoloType" substitutionGroup="abstractTitle"
/>
<xs:simpleType name="titoloType">
  <xs:restriction base="abstractTitleType">
    <xs:enumeration value="Sig" />
    <xs:enumeration value="Sig.ra" />
    <xs:enumeration value="Dott" />
    <xs:enumeration value="Dott.ssa" />
  </xs:restriction>
</xs:simpleType>

Without substitution groups for attributes, a complete translation of the
abstract vocabulary above would not be possible, as title is declared as
attribute.

Do the WG members think it is a valuable feature? If so, is it reasonable to
add support for such feature directly in version 1.1 of XSDL?

Thank you

Regards,
Paolo Marinelli

[1] http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2008Apr/0004.html
(member-only link)

Received on Friday, 2 May 2008 16:55:42 UTC