Można wykonać następujące czynności ...
<products>
<product featured="Yes">Prod 1</product>
<product>Prod 2</product>
</products>
Następnie za pomocą unikalnego elementu, aby ograniczyć atrybut zatem ...
<xs:unique name="UniqueFeaturedProduct">
<xs:selector xpath="product"/>
<xs:field xpath="@featured"/>
</xs:unique>
Jeśli było ograniczyć do „wyróżniona "atrybut do opcjonalnego wyliczenia jednej wartości" Tak ", wtedy mógł istnieć tylko jeden wyróżniany atrybut. Coś takiego ...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="products">
<xs:complexType>
<xs:sequence>
<xs:element name="product" type="productType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="UniqueFeaturedProduct">
<xs:selector xpath="product"/>
<xs:field xpath="@featured"/>
</xs:unique>
</xs:element>
<xs:simpleType name="featuredType">
<xs:restriction base="xs:string">
<xs:enumeration value="Yes"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="productType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="featured" type="featuredType" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
Nie wierzę, że jest to możliwe dzięki Schematowi XML. – skaffman