Stylus Studio XML Editor

Table of contents

Appendices

3.6 Attribute Group Definitions

Attribute Group Definitions

A schema can name a group of attribute declarations so that they may be incorporated as a group into complex type definitions.

Attribute group definitions do not participate in valid as such, but the [ct-attribute_declarations] and [ct-attribute_wildcard] of one or more complex type definitions may be constructed in whole or part by reference to an attribute group. Thus, attribute group definitions provide a replacement for some uses of XML's [parameter entity] facility. Attribute group definitions are provided primarily for reference from the XML representation of schema components (see [complexType] and [attributeGroup]).

NOTE: 
<xs:attributeGroup name="myAttrGroup">
    <xs:attribute . . ./>
    . . .
</xs:attributeGroup>

<xs:complexType name="myelement">
    . . .
    <xs:attributeGroup ref="myAttrGroup"/>
</xs:complexType>

XML representations for attribute group definitions. The effect is as if the attribute declarations in the group were present in the type definition.

The Attribute Group Definition Schema Component[top]

The Attribute Group Definition Schema Component

The attribute group definition schema component has the following properties:

[Attribute Group Definition]

Attribute groups are identified by their [ag-name] and [ag-target_namespace]; attribute group identities must be unique within an XML Schema. See [References to schema components across namespaces] for the use of component identifiers when importing one schema into another.

[ag-attribute_declarations] is a set attribute uses, allowing for local specification of occurrence and default or fixed values.

[ag-attribute_wildcard] provides for an attribute wildcard to be included in an attribute group. See above under [Complex Type Definitions] for the interpretation of attribute wildcards during valid.

See [Annotations] for information on the role of the [ag-annotation] property.

XML Representation of Attribute Group Definition Schema Components[top]

XML Representation of Attribute Group Definition Schema Components

The XML representation for an attribute group definition schema component is an [attributeGroup] element information item. It provides for naming a group of attribute declarations and an attribute wildcard for use by reference in the XML representation of complex type definitions and other attribute group definitions. The correspondences between the properties of the information item and properties of the component it corresponds to are as follows:

When an [attributeGroup] appears as a daughter of [schema] or [redefine], it corresponds to an attribute group definition as below. When it appears as a daughter of [complexType] or [attributeGroup], it does not correspond to any component as such.

[The Attribute Group Definition Schema Component]

The example above illustrates a pattern which recurs in the XML representation of schemas: The same element, in this case attributeGroup, serves both to define and to incorporate by reference. In the first case the name attribute is required, in the second the ref attribute is required, and the element must be empty. These two are mutually exclusive, and also conditioned by context: the defining form, with a name, must occur at the top level of a schema, whereas the referring form, with a ref, must occur within a complex type definition or an attribute group definition.

Constraints on XML Representations of Attribute Group Definitions[top]

Constraints on XML Representations of Attribute Group Definitions Attribute Group Definition Representation OK

In addition to the conditions imposed on [attributeGroup] element information items by the schema for schemas,

  1. The corresponding attribute group definition, if any, must satisfy the conditions set out in [Constraints on Attribute Group Definition Schema Components].

  2. If [c-awi1] or [c-awi2] in the correspondence specification in [XML Representation of Complex Type Definitions] for [ct-attribute_wildcard], as referenced above, is satisfied, the intensional intersection must be expressible, as defined in [Attribute Wildcard Intersection].

  3. Circular group reference is disallowed outside [redefine]. That is, unless this element information item's parent is [redefine], then among the [children], if any, there must not be an [attributeGroup] with ref [attribute] which resolves to the component corresponding to this [attributeGroup].

Attribute Group Definition Validation Rules[top]

Attribute Group Definition Validation Rules

None as such.

Attribute Group Definition Information Set Contributions[top]

Attribute Group Definition Information Set Contributions

None as such.

Constraints on Attribute Group Definition Schema Components[top]

Constraints on Attribute Group Definition Schema Components

All attribute group definitions (see [Attribute Group Definitions]) must satisfy the following constraint.

Attribute Group Definition Properties Correct
  1. The values of the properties of an attribute group definition must be as described in the property tableau in [The Attribute Group Definition Schema Component], modulo the impact of [Missing Sub-components];

  2. Two distinct members of the [ag-attribute_declarations] must not have [attribute]s both of whose [a-name]s match and whose [a-target_namespace]s are identical.

  3. Two distinct members of the [ag-attribute_declarations] must not have [attribute]s both of whose [a-simple_type_definition]s are or are derived from ID.