title: Restrict complexType with attributes in XSD?
body: <p>I'm working with an XSD such as: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
             elementFormDefault="qualified"&gt;
    &lt;xs:element name="algo"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element name="nota" type="t_algo" minOccurs="0"
                      maxOccurs="unbounded"/&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  
    &lt;xs:complexType name="t_algo"&gt;
      &lt;xs:restriction base="xs:string"&gt;
        &lt;xs:pattern value="[1][0]|[0-9]" /&gt;
      &lt;/xs:restriction&gt;
      &lt;xs:attribute name="modul" type="t_modul"/&gt;
    &lt;/xs:complexType&gt;
  
    &lt;xs:simpleType name="t_modul"&gt;
      &lt;xs:restriction base="xs:string"&gt;
        &lt;xs:pattern value="[m][0][0-9]"/&gt;
      &lt;/xs:restriction&gt; 
    &lt;/xs:simpleType&gt; 
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>and using a test XML like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;algo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="file:///D:/DAM/RECUF1/Mispruebas/telf.xsd"&gt;
    &lt;nota modul="m01"&gt;0&lt;/nota&gt;
    &lt;nota modul="m01"&gt;7&lt;/nota&gt;
    &lt;nota modul="m01"&gt;3&lt;/nota&gt;
    &lt;nota modul="m01"&gt;1&lt;/nota&gt;
  &lt;/algo&gt;
  </code></pre>
  
  <p>I want to have children <code>nota</code> with values between 0-10 and with the attribute <code>modul</code> with a value <code>m0X</code> where <code>x</code> between (0-9).  I thought the previous XSD would work, but it does not. Can somebody explain me what I'm doing wrong?</p>