July 2002
Intermediate to advanced
864 pages
22h 32m
English
We discussed earlier how you can make use of the ref attribute to make a reference to an attribute declaration that is declared globally within your schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="sku" type="xs:string"/>
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element name="item">
<xs:complexType>
<xs:attribute ref="sku"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
References are one way to organize your attributes and to reuse attributes—another way is the attribute group.
An <attributeGroup> allows you to declare attributes together within a common structure, and then reference that ...