基本型から要素を派生させたい。この基本型 (Entity と呼びましょう) には id 属性があります。派生要素の場合、この属性に制限を追加したいと思います (派生エンティティ要素ごとに異なる制限):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Entity">
<xs:attribute name="id">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]+[0-9]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="someEntity">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Entity">
<xs:sequence>
<xs:element name="someAdditionalElement"/>
</xs:sequence>
<!-- I would like to restrict the attribute "id" for this entity to e.g. the pattern "SOME[0-9]+" -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="otherEntity">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Entity">
<xs:sequence>
<xs:element name="otherAdditionalElement"/>
</xs:sequence>
<!-- I would like to restrict the attribute "id" for this entity to a differtnt pattern like e.g. "OTHER[0-9]+" -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
これは可能ですか?