title: XSD check if value is alphabetic order sorted
body: <p>I am stuck on an XSD check, I need to check if a code composed of 4 letters is valid, the first and the second two letters must be in alphabetic order example:</p>
  
  <p>ABCD or CDAB or EFBC etc...</p>
  
  <p>And letters cannot be repeated.</p>
  
  <p>I've got this so far:</p>
  
  <pre><code>&lt;xs:simpleType name="NameAddress"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:minLength value="0"/&gt;
              &lt;xs:maxLength value="4"/&gt;
              &lt;xs:pattern value="(A){0,1}(B){0,1}(C){0,1}(D){0,1}(E){0,1}(F){0,1}(G){0,1}(H){0,1}(J){0,1}(K){0,1}(L){0,1}(M){0,1}(P){0,1}(Q){0,1}(R){0,1}(S){0,1}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
  </code></pre>
  
  <p>But it only checks the alphabetic order in the sequence so if I write ABCD or CDEF it works, but it doesn't look behind and CDAB will fail.</p>
  
  <p>Is there any way to perform this?</p>
  
  <p>Thanks to all!</p>