<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="../test.css" ?>
<!DOCTYPE html [
	<!ATTLIST section id ID #IMPLIED>
	<!ATTLIST h       id ID #IMPLIED>
	<!ATTLIST div     id ID #IMPLIED>
	<!ATTLIST nl      id ID #IMPLIED>

  <!-- for the model attribute to work -->
  <!ATTLIST xforms:model id ID #IMPLIED>

  <!-- for the bind attribute to work -->
  <!ATTLIST xforms:bind id ID #IMPLIED>

  <!-- for the instance() function to work -->
  <!ATTLIST xforms:instance id ID #IMPLIED>

  <!-- for submit to work -->
  <!ATTLIST xforms:submission id ID #IMPLIED>

  <!-- for setfocus and other events to work -->
  <!ATTLIST xforms:input id ID #IMPLIED>
  <!ATTLIST xforms:secret id ID #IMPLIED>
  <!ATTLIST xforms:textarea id ID #IMPLIED>
  <!ATTLIST xforms:output id ID #IMPLIED>
  <!ATTLIST xforms:upload id ID #IMPLIED>
  <!ATTLIST xforms:range id ID #IMPLIED>
  <!ATTLIST xforms:trigger id ID #IMPLIED>
  <!ATTLIST xforms:submit id ID #IMPLIED>
  <!ATTLIST xforms:select id ID #IMPLIED>
  <!ATTLIST xforms:select1 id ID #IMPLIED>

  <!-- for toggle to work -->
  <!ATTLIST xforms:case id ID #IMPLIED>

  <!-- for repeat stuff to work -->
  <!ATTLIST xforms:repeat id ID #IMPLIED>

  <!-- (also any element with xforms:repeat-* attributes -->
 	<!ATTLIST table      id ID #IMPLIED>
  <!ATTLIST td         id ID #IMPLIED>
]>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:my="http://example.info/ns"
      xmlns:type="http://example.info/types"
      xml:lang="en">
  <head>
    <title>Testing the pattern facet</title>

    <xforms:model>
      <xsd:schema targetNamespace="http://example.info/types">
        <xsd:simpleType name="t1">
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="\p{Sm}\p{Zs}\p{Pc}\p{Nd}\p{Lt}"/>
          </xsd:restriction>
        </xsd:simpleType>

        <xsd:simpleType name="t2">
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="\P{Cf}\P{Sm}\P{Zs}\P{Pc}\P{Nd}\P{Mn}\P{Lt}"/>
          </xsd:restriction>
        </xsd:simpleType>

        <xsd:simpleType name="t3">
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="\(\{\[\?\.\-\^\*\+\]\}\)"/>
          </xsd:restriction>
        </xsd:simpleType>

        <xsd:simpleType name="t4">
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="AB?C*D+E{3,5}F{4}G{2,}H{0,6}I{0,0}"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:schema>
      <xforms:instance>
        <my:container dummy="">
          <my:test1>&#x2190;&#xA0;&#x2040;&#x0660;&#x01C5;</my:test1>
          <my:test2>&#x2190;&#xA0;&#x2040;&#x0660;&#x01C5;</my:test2>
          <my:test3>({[?.-^*+]})</my:test3>
          <my:test4>ACCCCDDEEEFFFFGG</my:test4>
        </my:container>
      </xforms:instance>
      <xforms:bind nodeset="my:test1" type="type:t1"/>
      <xforms:bind nodeset="my:test2" type="type:t2"/>
      <xforms:bind nodeset="my:test3" type="type:t3"/>
      <xforms:bind nodeset="my:test4" type="type:t4"/>
    </xforms:model>

  </head>
  <body>
    <h>Testing the pattern facet</h>
    <p>Assertions tested by this test case:</p>
    <nl>
        <li>Pattern facet in derivation</li>
    </nl>

    <output ref="my:container/@dummy"><label>To pass, test1, test3, and test4 must initially be considered valid.
    Test2 must be considered invalid. Validation must continue to be correctly enforced as values are interactively
    changed.</label></output>  
    
    <xforms:input ref="my:test1">
      <xforms:label>Test 1</xforms:label>
    </xforms:input>

    <xforms:input ref="my:test2">
      <xforms:label>Test 2 (initially invalid)</xforms:label>
    </xforms:input>

    <xforms:input ref="my:test3">
      <xforms:label>Test 3</xforms:label>
    </xforms:input>

    <xforms:input ref="my:test4">
      <xforms:label>Test 4</xforms:label>
    </xforms:input>

  </body>
</html>
