title: Unqualified XSD global attribute references
body: <p>The following XML schema fails to validate with following XML instance document. Is there any way to rewrite the schema so the instance document validates, within the given constraints?</p>
  
  <h2>Constraints</h2>
  
  <ul>
  <li>The attribute cannot be local to the element</li>
  <li>The instance document must be unchanged</li>
  </ul>
  
  <h2>(Invalid) Schema</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
      elementFormDefault="qualified"
      xmlns="http://tempuri.org/XMLSchema.xsd"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  
      &lt;xs:attribute name="sample-attribute" type="xs:string" /&gt;
  
      &lt;xs:element name="sample-element"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute ref="sample-attribute" use="required" /&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <h2>Instance</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;sample-element xmlns="http://tempuri.org/XMLSchema.xsd" sample-attribute="test" /&gt;
  </code></pre>