This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5296 - An oddity with substitution groups
Summary: An oddity with substitution groups
Status: CLOSED WORKSFORME
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard: medium, work
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-29 13:52 UTC by Michael Kay
Modified: 2008-01-25 00:24 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2007-11-29 13:52:37 UTC
Consider a base type:

    <xs:complexType name="b">
       <xs:sequence>     
         <xs:element ref="a"/>
       </xs:sequence>
    </xs:complexType>

and a supposedly derived type

     <xs:complexType name="r">
      <xs:complexContent>
        <xs:restriction base="b">
          <xs:sequence>
            <xs:element name="A"/> <!--NB name, not ref-->
          </xs:sequence>
        </xs:restriction>
      </xs:complexContent>
    </xs:complexType> 

with the element declarations

<xs:element name="a"/>
<xs:element name="A" substitutionGroup="a"/>

Is r validly derived from b? As far as I can see, it satisfies "Content type restricts", despite the fact that the local element declaration A is not a member of the substitution group of "a" (local element declarations never belong to a substitution group). 

Is this intended?
Comment 1 Sandy Gao 2007-12-10 15:10:54 UTC
You can view this as derivation in 2 steps:
Step 1: "a" -> ref="A" (replace head with member)
Step 2: ref="A" -> name="A" (replace global with local)

If both these 2 steps are valid (which seems to be the case in this example), they can be collapsed into a single step, which explains why the example is valid.
Comment 2 David Ezell 2008-01-24 18:47:16 UTC
The WG discussed this issue and determined that the answer in comment #1 is correct; i.e. that the effect is intended.

Please let us know if you agree with this resolution of your issue, by adding a comment to the issue record and changing the Status of the issue to Closed. Or, if you do not agree with this resolution, please add a comment explaining why. If you wish to appeal the WG's decision to the Director, then also change the Status of the record to Reopened. If you wish to record your dissent, but do not wish to appeal the decision to the Director, then change the Status of the record to Closed. If we do not hear from you in the next two weeks, we will assume you agree with the WG decision.