title: How to restrict an attribute of an extended type
body: <p>I want to derive elements from a base type. This base type (let's call it Entity) has an id attribute. For derived elements I want to add restrictions to this attribute (different restrictions for different derived Entity elements):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
      &lt;xs:complexType name="Entity"&gt;
          &lt;xs:attribute name="id"&gt;
              &lt;xs:simpleType&gt;
                  &lt;xs:restriction base="xs:string"&gt;
                      &lt;xs:pattern value="[A-Z]+[0-9]+"/&gt;
                  &lt;/xs:restriction&gt;
              &lt;/xs:simpleType&gt;
          &lt;/xs:attribute&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:element name="someEntity"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:complexContent&gt;
                  &lt;xs:extension base="Entity"&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name="someAdditionalElement"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;!-- I would like to restrict the attribute "id" for this entity to e.g. the pattern "SOME[0-9]+" --&gt;
                  &lt;/xs:extension&gt;
              &lt;/xs:complexContent&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="otherEntity"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:complexContent&gt;
                  &lt;xs:extension base="Entity"&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name="otherAdditionalElement"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;!-- I would like to restrict the attribute "id" for this entity to a differtnt pattern like e.g. "OTHER[0-9]+" --&gt;
                  &lt;/xs:extension&gt;
              &lt;/xs:complexContent&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Is this possible and if yes, how?</p>