title: XSD Allow constrained but extendable list of children
body: <p>I have a job-control XML schema I'm trying to develop an XSD for, but XSD appears to be designed for top-down restrictive children selection, and groups can only be added to at declaration, not contributed to by later extension files.</p>
  
  <p>An abbreviated example document follows...</p>
  
  <pre><code>&lt;sxtdl xmlns="http://********/xsd/sxtdl" xmlns:map="http://********/xsd/sxtdl/map"&gt;
      &lt;reference name="internal" /&gt;
  
      &lt;process id="Tests/SxTDL/Map/Map Initialize"&gt;
          Make sure this variable did not previously exist, then
          initialize a map into it and check that it exists.
          &lt;not&gt;
              &lt;expect variable="testmap" /&gt;
          &lt;/not&gt;
          &lt;map:initialize name="testmap" /&gt;
          &lt;expect variable="testmap" /&gt;
      &lt;/process&gt;
  &lt;/sxtdl&gt;
  </code></pre>
  
  <p>Notes on the expected schema here:</p>
  
  <ul>
  <li>The root element <code>sxtdl</code> allows any number of "Declaration"s as children. <code>reference</code> and <code>process</code> are Declarations.</li>
  <li>The <code>process</code> Declaration allows any number of "Directives" as children.</li>
  <li>Many Directive elements may take sub-Directives as children, such as the <code>not</code> element seen here.</li>
  <li>I need to be able to recognize Directives from extension sources, such as the Key-Value-Map related directives shown in namespace <code>map:</code> above.</li>
  </ul>
  
  <p>Ideally what I would like to be able to do is avoid adding <code>&lt;any/&gt;</code> into the accepted children of <code>sxtdl</code>, <code>process</code>, <code>not</code>, et cetera, but instead somehow specify something equivalent to <code>&lt;any namespace="##any" fromGroup="DirectiveGroup" minOccurs="0" maxOccurs="unbounded" /&gt;</code>, while somehow appending to DirectiveGroup in those other XSD documents (such as the one for the namespace <code>.../sxtdl/map</code>).</p>
  
  <p>The closest I can find to this is substitution groups, but it appears I can only substitute an element for another if the substitution has the same type, just a different tag name... which won't work for Directives that have their own distinct sets of valid attributes.</p>