title: XML Schema: Restrict child element based on attribute value of parent element?
body: <p>Is there any way to restrict the use of an XML element's sub elements, depending on the attribute value of the parent element in XML Schema? How does the schema have to look like?</p>
  
  <pre><code>&lt;option name="mike" value="excset"&gt;
    &lt;excludingsets&gt;
      &lt;excludingset&gt;
        &lt;option name="hd"/&gt;
      &lt;/excludingset&gt;
    &lt;/excludingsets&gt;
  &lt;/option&gt;
  &lt;option name="mike" value="args"&gt;
    &lt;arguments&gt;
      &lt;argument name="kjk" validatortype="regex"&gt;
        &lt;regex value="dkas"/&gt;
      &lt;/argument&gt;
    &lt;/arguments&gt;
  &lt;/option&gt;
  </code></pre>
  
  <p>As you can see in this example, the element <code>&lt;excludingset&gt;</code> should only be valid if the attribute value of <code>&lt;option&gt;</code> is <code>value="excset"</code>, and the element <code>&lt;arguments&gt;</code> if it has <code>value="args"</code>.</p>
  
  <p>Thanks in advance.</p>