title: How can you validate Elements based on an attribute Value using a Schema?
body: <p>The XML I'm trying to validate is as follows:</p>
  
  <pre><code>&lt;root&gt;
      &lt;element attribute="foo"&gt;
          &lt;bar/&gt;
      &lt;/element&gt;
      &lt;element attribute="hello"&gt;
          &lt;world/&gt;
      &lt;/element&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>How can this be validated using a Schema?</p>
  
  <p>Note:</p>
  
  <p><strong>element</strong> can only contain <strong>bar</strong> when <strong>attribute="foo"</strong>.</p>
  
  <p><strong>element</strong> can only contain <strong>world</strong> when <strong>attribute="hello"</strong></p>