<!DOCTYPE testSet SYSTEM "../ancillary/AnnotatedTSSchema.dtd" [

<!ENTITY TSNS "http://www.w3.org/XML/2004/xml-schema-test-suite/">
<!ATTLIST testSet 
          xmlns CDATA '&TSNS;'
>
<!ENTITY % html-for-documentation SYSTEM
  "../ancillary/xhtml-for-annotation.dtd">
%html-for-documentation;

]>
<?xml-stylesheet href="../ancillary/xsts.xsl" type="text/xsl" ?>

<testSet name = "sg-definedSib"

         contributor = "C. M. Sperberg-McQueen" 
         xmlns       = "&TSNS;"
         xmlns:xs    = "http://www.w3.org/2001/XMLSchema"
         xmlns:xlink = "http://www.w3.org/1999/xlink"

>
 <annotation>
  <documentation>
   <div xmlns="http://www.w3.org/1999/xhtml">
    <p>A set of tests on changes to substition-group behavior,
     constructed by hand, as a contribution to the XML Schema 1.1
     test suite.
    </p>
    <p>Revisions:</p>
    <ul>
     <li>2010-06-10 : CMSMcQ : create this test catalog,
                               using XHTML modularization driver.
     </li>
    </ul>
   </div>
  </documentation>
 </annotation>

 <annotation>
  <documentation>
   <div xmlns="http://www.w3.org/1999/xhtml"
    >
    <p>
     In section <a href="http://www.w3.org/TR/xmlschema11-1/#ch_models"
      >G.1.3 Changes to content models</a>, XSD 1.1 says
     (in list item 3):
    </p>
    <blockquote>
     <p>Finally, the keyword ##definedSibling can be used to exclude
      all elements explicitly mentioned in a content model (and all
      elements substitutable for those elements).</p>
    </blockquote>
    <p>   
     So we test the following interactions of definedSibling
     and substitution groups, in schemas with some subset of
     elements e, s, n, s1, n1, s2, n2, with s1 substitutable 
     ('s') for s, and s2 for s1, but n1 and n2 <em>not</em>
     substitutable for n (or anything else).  Elements n and s are
     siblings, together with a negative wildcard (no positive 
     wildcard is possible) which has the keyword #definedSibling.
    </p>
    <ol>
     <li>A negative wildcard excludes s1 but not n1.</li>
     <li>A negative wildcard competes with n but not s.</li>
    </ol>
    <p>
     10 June 2010.
    </p>
   </div>
  </documentation>
 </annotation>

 <testGroup name="i1">
  <annotation>
   <documentation>
    <div xmlns="http://www.w3.org/1999/xhtml">
     <p>
      Negative wildcard excludes s1 but not n1.
     </p>
    </div>
   </documentation>
  </annotation>
  <schemaTest name="snneg">
   <schemaDocument xlink:href="snneg.xsd"/>
   <expected validity="valid"/>
  </schemaTest>  
  <instanceTest name="sn">
   <instanceDocument xlink:href="sn.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="s1n">
   <instanceDocument xlink:href="s1n.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="sn1">
   <instanceDocument xlink:href="sn1.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
  <instanceTest name="sne">
   <instanceDocument xlink:href="sne.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="snn">
   <instanceDocument xlink:href="snn.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
  <instanceTest name="sns">
   <instanceDocument xlink:href="sns.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
  <instanceTest name="snn1">
   <instanceDocument xlink:href="snn1.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="sns1">
   <instanceDocument xlink:href="sns1.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
 </testGroup>

 <testGroup name="i2">
  <annotation>
   <documentation>
    <div xmlns="http://www.w3.org/1999/xhtml">
     <p>
      Negative wildcard excludes s1 but not n1.
      (Second time around).
     </p>
    </div>
   </documentation>
  </annotation>
  <schemaTest name="negsn">
   <schemaDocument xlink:href="negsn.xsd"/>
   <expected validity="valid"/>
  </schemaTest>  
  <instanceTest name="esn">
   <instanceDocument xlink:href="esn.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="nsn">
   <instanceDocument xlink:href="nsn.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
  <instanceTest name="ssn">
   <instanceDocument xlink:href="ssn.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
  <instanceTest name="n1sn">
   <instanceDocument xlink:href="n1sn.xml"/>
   <expected validity="valid"/>
  </instanceTest>
  <instanceTest name="s1sn">
   <instanceDocument xlink:href="s1sn.xml"/>
   <expected validity="invalid"/>
  </instanceTest>
 </testGroup>

 <testGroup name="s3">
  <annotation>
   <documentation>
    <div xmlns="http://www.w3.org/1999/xhtml">
     <p>A negative wildcard competes with n.</p>
    </div>
   </documentation>
  </annotation>
  <schemaTest name="snqneg">
   <schemaDocument xlink:href="snqneg.xsd"/>
   <expected validity="invalid"/>
  </schemaTest>  
 </testGroup>

 <testGroup name="s4">
  <annotation>
   <documentation>
    <div xmlns="http://www.w3.org/1999/xhtml">
     <p>A negative wildcard does not compete with s.</p>
    </div>
   </documentation>
  </annotation>
  <schemaTest name="nsqneg">
   <schemaDocument xlink:href="nsqneg.xsd"/>
   <expected validity="valid"/>
  </schemaTest>  
 </testGroup>

</testSet>
