title: XSD Two elements with the same name but different attribute value
body: <p>I am trying to define an XSD template for the following:</p>
  
  <pre><code>&lt;template_data&gt;
    &lt;given_name lang="ENG"&gt;Zluty&lt;/given_name&gt;
    &lt;given_name lang="CES"&gt;Žlutý&lt;/given_name&gt;
  &lt;/template_data&gt;
  </code></pre>
  
  <p>So far, I've come up with</p>
  
  <pre><code>&lt;xs:complexType name="attribute_CES"&gt;
    &lt;xs:attribute name="lang" type="xs:string" use="required" fixed="CES"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="attribute_ENG"&gt;
    &lt;xs:attribute name="lang" type="xs:string" use="required" fixed="ENG"/&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:element name="template_data"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="given_name" type="attribute_CES"/&gt;
        &lt;xs:element name="given_name" type="attribute_ENG"/&gt;          
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>Problem is, this defines an element with one and the same name two times, each time with a different type, to which any XSD validator I've found protests.</p>
  
  <p>As far as I know, you can require an attribute to have a specific value with the <code>fixed</code> option, and that is included in the definition of a (complex) type. So if you want the attribute with a different value, you would have to define a new type.</p>
  
  <p>What I need is the <code>template_data</code> to include both <code>given_name</code>s, exactly once with <code>lang="CES"</code>, and exactly once with <code>lang="ENG"</code>. Is there a way to write an xsd validation schema for that, or is that impossible (for example if the xml input doesn't conform to standards)?</p>