- From: Eric van der Vlist <vdv@dyomedea.com>
- Date: Thu, 06 Dec 2001 17:38:51 +0100
- To: xmlschema-dev@w3.org
Given that a substitution group is kind of equivalent to xs:choice: http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict 2.1 Any top-level element declaration particle (in R or B) which is the {substitution group affiliation} of one or more other element declarations is treated as if it were a choice group whose {min occurs} and {max occurs} are those of the particle, and whose {particles} consists of one particle with {min occurs} and {max occurs} of 1 for the top-level element declaration and for each of the declarations in its ·substitution group·. Does that mean that we can restrict substitution groups? If for instance I have: <xs:element name="head"/> <xs:element name="a" substitutionGroup="head"/> <xs:element name="b" substitutionGroup="head"/> <xs:element name="c" substitutionGroup="head"/> and: <xs:complexType name="base"> <xs:sequence> <xs:element ref="head"/> </xs:sequence> </xs:complexType> is <xs:complexType name="derived"> <xs:complexContent> <xs:restriction base="base"> <xs:sequence> <xs:choice> <xs:element ref="a"/> <xs:element ref="b"/> </xs:choice> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> a valid restriction? I guess not since it doesn't seem to match the condition for restricting choices: Schema Component Constraint: Particle Derivation OK (Choice:Choice -- RecurseLax) For a choice group particle to be a ·valid restriction· of another choice group particle all of the following must be true: 1 R's occurrence range is a valid restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6); 2 There is a complete ·order-preserving· functional mapping from the particles in the {particles} of R to the particles in the {particles} of B such that each particle in the {particles} of R is a ·valid restriction· of the particle in the {particles} of B it maps to as defined by Particle Valid (Restriction) (§3.9.6). NOTE: Although the ·validation· semantics of a choice group does not depend on the order of its particles, derived choice groups are required to match the order of their base in order to simplify checking that the derivation is OK. The question should then probably be which is the order of the elements of a substitution group when they are mapped to a xs:choice during validation (and how can this be used to restrict a substitution group) ? Thanks Eric -- See you in Orlando for XML 2001. http://www.xmlconference.net/xmlusa/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com http://xsltunit.org http://4xt.org http://examplotron.org ------------------------------------------------------------------------
Received on Thursday, 6 December 2001 11:38:57 UTC