title: Set attribute to all types in XML Schema
body: <p>I store settings of my script in <code>XML</code> document. The script is multiplatform but some of its settings are not. I created proper attribute in my <code>XSD</code> file. It decides to which system is the setting.</p>
  
  <pre><code>&lt;xs:attribute name="system" use="optional" default="none"&gt;
      &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:enumeration value="none"/&gt;
              &lt;xs:enumeration value="windows"/&gt;
              &lt;xs:enumeration value="unix"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
  &lt;/xs:attribute&gt;
  </code></pre>
  
  <p>A sample <code>XML</code> file looks like below. (Don't read too carefully. It's just an example.)</p>
  
  <pre><code>&lt;root&gt;
      &lt;name&gt;Foo&lt;/name&gt;
      &lt;path system="windows"&gt;%appdata%\Bar&lt;/path&gt;
      &lt;path system="unix"&gt;~/Bar/&lt;/path&gt;
      &lt;foo system="unix"&gt;
          &lt;bar&gt;baz&lt;/bar&gt;
          &lt;!-- more elements --&gt;
      &lt;/foo&gt;
      &lt;foo&gt;
          &lt;bar system="windows"&gt;baz&lt;/bar&gt;
          &lt;!-- more elements --&gt;
      &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The problem is I need possibility to add attribute <code>system</code> to each element of my <code>XML</code>. At this moment I can't simply write:</p>
  
  <pre><code>&lt;xs:element name="path" type="xs:string"/&gt;
  </code></pre>
  
  <p>Instead that I have to write:</p>
  
  <pre><code>&lt;xs:element name="path"&gt;
      &lt;xs:complexType&gt;
          &lt;xs:simpleContent&gt;
              &lt;xs:extension base="xs:string"&gt;
                  &lt;xs:attribute ref="system"/&gt;
              &lt;/xs:extension&gt;
          &lt;/xs:simpleContent&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>(I know that I can define complex type before and use it multiple times.) It is very expanded <code>XSD</code> and I have a lot of my own types in it. Many of them are used in one place only. Actually I set attribute <code>system</code> to each type in my <code>XSD</code> but it takes a lot of space and is not very readable.</p>
  
  <p><strong>Is it possible to set attribute to <em>all</em> types in <code>XSD</code>?</strong></p>