<?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>
  
  <!NOTATION XMLFile SYSTEM "XML 1.0 Recommendation http://www.w3.org/TR/REC-xml">
  <!ENTITY ThisFileEntity SYSTEM "./002.xml" NDATA XMLFile>
]>
<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"
      xml:lang="en">
  <head>
    <title>Support for XForms Full built-in data types</title>

    <xforms:model id="M">
      <xforms:instance xmlns="">
        <root dummy="">      
      
      <listItem xsi:type="xforms:listItem" plainText="vanilla" badval="a b"/>
      <listItems xsi:type="xforms:listItems" plainText="chocolate vanilla strawberry" badval=""/>
      <dayTimeDuration xsi:type="xforms:dayTimeDuration" plainText="P3DT4H5M6S" badval="P1M"/>
      <yearMonthDuration xsi:type="xforms:yearMonthDuration" plainText="P1Y2M" badval="P1D"/>
        </root>  
      </xforms:instance>
      
      <!-- Here is the bind that copies the 'plainText' values to
      		the schema validated values. -->
      		
      <xforms:bind nodeset="/root/*" calculate="./@plainText"/>
      
      <!-- Here is a 'bogus' submission element. It is not designed 
      		to actually run since a data revalidation error is
      		supposed to prevent the submission -->
      		
      <xforms:submission action="http://example.org/dummy.jsp" method="post" id="s00"/>

      <!-- Here is the event handler that generates a message reporting
      		a submit error -->
      		
      <xforms:message level="modal" ev:event="xforms-submit-error">The submission has failed</xforms:message>
    </xforms:model>

  </head>
  <body>
    <h>Support for XForms-defined data types</h>

    <p>Assertions tested by this test case:</p>
    <nl>
        <li href="..\chapter5.xml">XForms processors MUST support all XForms Basic built-in types 
	(primitive and derived, marked by asterisk)</li>
    </nl>

    <!-- This informs the user of the steps necessary to succeed at this test.
    		The ref to the dummy attribute was necessary because some 
    		early implementations crashed when an output didn't bind to
    		a node.  This is done as an xforms output to make sure that
    		users of implementations that don't understand html as host 
    		language still understand what to do. -->
    		
    <group xmlns="http://www.w3.org/2002/xforms"> 	
	<output model="M" ref="/root/@dummy">
		<label>This form contains input fields that are bound to plaintext attributes of instance data.  The attributes are bound by a calculate to schema validated instance nodes.</label>
    	</output>
 	<output model="M" ref="/root/@dummy">
		<label>The output below each input binds to the validated instance node whose corresponding plaintext is bound to the input.</label>   	
	</output>
	<output model="M" ref="/root/@dummy">
		<label>When first opened, all outputs should be bound to schema valid instance nodes.  Verify this by pressing the submit button. The implementation should attempt to connect to a bogus URL.</label>
	</output>
	<output model="M" ref="/root/@dummy">
		<label>Then, for each input field, enter the recommended invalid data, then hit submit.  A message box should display to inform you that the submission has failed. </label>   	
	</output>
	<output model="M" ref="/root/@dummy">
		<label>Once you see the submission failure, restore the good value to the input, then move on to the next input.</label>   	
	</output>
    </group>
    
    <!-- TBD: Insert XForms controls, etc. here -->

    <group xmlns="http://www.w3.org/2002/xforms">
           
	<submit submission="s00">
          	<label>Try to submit</label>
	</submit>
	
	<repeat model="M" nodeset="/root/*" id="R">
	
		<!-- These are string inputs that have initial good values
			and are changed to bad values to test schema 
			validation.  We do not bind directly to schema
			validated nodes because different implementations
			produce different UI elements, some of which make
			it impossible to enter bad data. -->
			
		<input model="M" ref="./@plainText">
			<label>Enter a non-<output value="local-name(..)"/> (change to <output value="string(../@badVal)"/>)</label>
		</input>

		<!-- These are outputs that simply show that the input was indeed 
			indeed moved from the plainText to the schema validated
			nodes. Schema invalidity is also evident in these outputs -->

		<output model="M" ref=".">
			<label>The value of <output value="local-name(.)"/>:</label>
		</output>
	</repeat>
    </group>
 
  </body>
</html>


