Re: block="substitution" in local element definitions

Hi Simon,

> But in Structures it says at [2]
>
> "[Definition:] Through the new mechanism of element substitution
> groups, XML Schemas provides a more powerful model supporting
> substitution of one named element for another. Any top-level element
> declaration can serve as the defining element, or head, for an
> element substitution group. Other *top-level* element declarations,
> regardless of target namespace, can be designated as members of the
> substitution group headed by this element. "
>
> Is this the normative restriction in the spec? I cannot find any
> other reference requiring substitutionGroup members or heads to be
> global/top-level ...

I think that this is a normative restriction in the spec. Substitution
groups are actually defined as follows:

  Schema Component Constraint: Substitution Group

  [Definition:] Every element declaration in the {element
  declarations} of a schema defines a substitution group, a subset of
  those {element declarations}, as follows:
  1 The element declaration itself is in the group;
  2 The group is closed with respect to {substitution group
    affiliation}, that is, if any element declaration in the {element
    declarations} has a {substitution group affiliation} in the group,
    then it is also in the group itself.
                     http://www.w3.org/TR/xmlschema-1/#cos-equiv-class
    
What's relevant here is that the substitution group is made up of
a subset of element declarations from the {element declarations} of
the schema. The {element declarations} of the schema are defined as:

  A set of named (top-level) element declarations.
                http://www.w3.org/TR/xmlschema-1/#element_declarations

So substitution groups can only contain global element declarations.

This is backed up by the fact that the schema for schemas only allows
substitutionGroup attributes on top-level element declarations, not on
local element declarations. The head of the substitution group must be
a global element declaration; otherwise it would be impossible for the
schema validator to locate it when it's referred to through the
substitutionGroup attribute.

I hope that clarifies things for you,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 19 February 2002 07:33:36 UTC