title: Is it possible to make XSD conditional on element and attribute values, not names?
body: <p>Is it possible to write conditional based xsd. I have list of countries defined in my xsd, If user choose country as UNITED  STATES, xsd should allow user to select the states which belong to above choosen country, Else it should show validation error. Below example, perfectly allow user to select country and state for the below list, But it does not perform any validations agaist country. If you have any suggestions to write choice based xsd, Please let me know. Please note that, I have tried <code>&lt;xs:choice&gt;</code>, it does not work for this scenario.  </p>
  
  <pre><code>&lt;xs:complexType name="header-type"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="country" type="country-type" /&gt;
          &lt;xs:element name="states" type="state-type" /&gt;
      &lt;/xs:complextType&gt;
          &lt;xs:simpleType name="country-type"&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:enumeration value="UNITEDSTATES"&gt;&lt;/xs:enumeration&gt;
                  &lt;xs:enumeration value="AUS"&gt;&lt;/xs:enumeration&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
          &lt;xs:simpleType name="state-type"&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:enumeration value="California"&gt;&lt;/xs:enumeration&gt;
                  &lt;xs:enumeration value="Sydney"&gt;&lt;/xs:enumeration&gt;
                  &lt;xs:enumeration value="Texas"&gt;&lt;/xs:enumeration&gt;
          &lt;/xs:simpleType&gt;
  </code></pre>