title: DTD (or XSD) problem with duplicate name element having different scopes
body: <p>I extracted a xml fragment on which I am working for a DTD, pratically I need a specific declaration for resource contained in tag resources and another different one for resource contained in tag input. The problem is that the first one requires the id attribute, the second one does not require the id attribute because uses alternative attributes. Is it possible to declare something like (pseudocoded): </p>
  
  <p></p>
  
  <p></p>
  
  <p>The xml fragment:</p>
  
  <pre><code>&lt;xml&gt;
  
    &lt;resources&gt;
      &lt;resource id="somedir"&gt;sometpath&lt;/resource&gt;
    &lt;/resources&gt;
  
  ...
  
    &lt;input&gt;
      &lt;resource exists="false"&gt;
        &lt;path&gt;somepath&lt;/path&gt;
      &lt;/resource&gt;
    &lt;/input&gt;
  
  &lt;/xml&gt;
  </code></pre>
  
  <p>Is it possible with DTD or XSD?</p>
  
  <p>Thanks </p>