Bạn có thể làm như sau ...
<products>
<product featured="Yes">Prod 1</product>
<product>Prod 2</product>
</products>
Sau đó sử dụng một yếu tố duy nhất để hạn chế các thuộc tính như vậy ...
<xs:unique name="UniqueFeaturedProduct">
<xs:selector xpath="product"/>
<xs:field xpath="@featured"/>
</xs:unique>
Nếu bạn đã hạn chế 'đặc trưng 'thuộc tính cho một liệt kê tùy chọn của một giá trị "Có" thì chỉ có thể có một thuộc tính nổi bật. Một cái gì đó như thế này ...
<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>
Tôi không tin điều này là có thể với Lược đồ XML. – skaffman