Appendix C: Sample Forms


C.1 XForms and XHTML

XHTML Document with Multiple XForms - Page.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xml:lang="en" lang="en" 

  <title>Sample XForms Document</title>
  <xform xmlns="">

    <submit id="sub-a" target="" />
    <submit id="sub-b" target="" />

    <!-- Define the XForms Model for the opinion poll -->

    <model id="poll">
        <number name="choiceCode" enum="closed">

    <!-- Define the XForms Model for the search -->

    <model id="search">
      <schema xmlns="">
        <element name="query">
            <attribute name="searchstring" type="string" />

    <!-- pre-initialized instance data for the search form -->

    <instance model="search" xmlns="">
      <query searchstring="Enter your Query Here" />

    <bind id="Query" ref="instance::search/query/searchstring"/>


  <!-- ... -->

  <!-- Site Search Markup -->
  <xfm:textbox ref="id('Query')">
    <xfm:caption>Search our Web Site<xfm:caption>
    <xfm:help>Enter your search term here and hit "Go!"</xfm:help>
  <xfm:submit ref="instance::sitesearch" to="sub-a">

  <!-- ... -->

  <!-- Daily Poll Markup -->
  <xfm:exclusiveSelect style="list-ui: radio" ref="model::poll/choiceCode">
    <xfm:caption>When do you plan to implement XForms?</xfm:caption>
    <xfm:item value="-1">Don't know</xfm:item>
    <xfm:item value="10">0-6 Months</xfm:item>
    <xfm:item value="20">6-12 Months</xfm:item>
    <xfm:item value="30">More than 12 Months</xfm:item>
  <xfm:submit ref="model::poll" to="sub-b">

  <!-- ... -->

This is an example of a single document that might be hand authored. This example shows an XHTML document with two separate XForms embedded using simple syntax, one with a set of initial instance data.
Sample Instance Data for Poll

Here is a sample of the instance data for the Poll form.

Sample Instance Data for Site Search
<query xmlns="" searchstring="MP3" />

Here is a sample of the instance data for Site Search form.