Control element cardinality based on an attribute enumeration in XSD?
<p>I want the <code>character</code> element to be repeatable if the <code>cell</code> @type is <code>filled</code>, <code>numbered</code>, <code>specialNumbered</code>, or <code>specialUnnumbered</code>. I want the <code>character</code> element NOT to be repeatable if the <code>cell</code> @type is <code>multiCharacterNumbered</code> or <code>multiCharacterUnnumbered</code>.  </p>

<p>If the <code>cell</code> type is <code>blank</code>, I'd like to disallow the <code>character</code> element altogether.</p>

<p>Does this require XSD 1.1? How do I form the conditional or test?</p>

<pre><code>&lt;xs:element name="cell" maxOccurs="unbounded"&gt;
    &lt;xs:complexType&gt;
         &lt;xs:sequence&gt;
             &lt;xs:element name="character" type="xs:string" minOccurs="0"/&gt;
         &lt;/xs:sequence&gt;
         &lt;xs:attribute name="type" use="required"&gt;
              &lt;xs:simpleType&gt;
                   &lt;xs:restriction base="xs:string"&gt;
                        &lt;xs:enumeration value="filled"/&gt;
                        &lt;xs:enumeration value="blank"/&gt;
                        &lt;xs:enumeration value="numbered"/&gt;
                        &lt;xs:enumeration value="specialNumbered"/&gt;
                        &lt;xs:enumeration value="specialUnnumbered"/&gt;
                        &lt;xs:enumeration value="multiCharacterNumbered"/&gt;
                        &lt;xs:enumeration value="multiCharacterUnnumbered"/&gt;
                   &lt;/xs:restriction&gt;
               &lt;/xs:simpleType&gt;
          &lt;/xs:attribute&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
</code></pre>