<?xml version="1.0" encoding="UTF-8"?>

<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
<!--
   
   Pages Schema for Paloose Forms
   
   Author:
      Name  : Hugh Field-Richards.
      Email : hsfr@hsfr.org.uk
   
   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
   
   Version   Date                   Who    Changes
   ==========================================================================
   
   0.0.0     8th March 2007         HSFR   Created
   
   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Copyright -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
   
   This software is published under the terms of the LGPL License
   a copy of which has been included with this distribution in the LICENSE file.
   
-->

<grammar 
   xmlns="http://relaxng.org/ns/structure/1.0"
   xmlns:a="http://relaxng.org/ns/annotation/1.0"
   xmlns:xhtml="http://www.w3.org/1999/xhtml" 
   xmlns:sch="http://www.ascc.net/xml/schematron"
   xmlns:xi="http://www.w3.org/2001/XInclude"
   xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
   xmlns:dc="http://purl.org/dc/elements/1.1/" 
   xmlns:dcterms="http://purl.org/dc/terms/"
   xmlns:page="http://www.hsfr.org.uk/Schema/Page" 
   xmlns:list="http://www.hsfr.org.uk/Schema/List"
   xmlns:person="http://www.hsfr.org.uk/Schema/Person"
   xmlns:i18n="http://apache.org/cocoon/i18n/2.1" 
   xmlns:text="http://www.hsfr.org.uk/Schema/Text"
   xmlns:version="http://www.hsfr.org.uk/Schema/Version"
   xmlns:system="http://www.hsfr.org.uk/Schema/System"
   xmlns:pf="http://www.paloose.org/schemas/Forms/1.0"
   datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
   
   <a:documentation>
      <dc:title>RELAX NG Schema for Paloose Forms</dc:title>
      <dc:creator>Hugh Field-Richards</dc:creator>
      <dc:date>2007-02-09T19:00</dc:date>
      <dc:language>en</dc:language>
   </a:documentation>
   
   <xhtml:p>The Paloose Forms Definition. These are (loosely) based on
      <a href="http://webapp.icpsr.umich.edu/cocoon/docs/userdocs/flow/jxforms.html">JXForms</a>
      (themselves based on XForms).</xhtml:p>
   <xhtml:hr/>
   
   <xhtml:p>These are the namespaces needed by the Schematron validator.</xhtml:p>
   
   <sch:ns prefix="page" uri="http://www.hsfr.org.uk/Schema/Page"/>
   <sch:ns prefix="link" uri="http://www.hsfr.org.uk/Schema/Link"/>
   <sch:ns prefix="list" uri="http://www.hsfr.org.uk/Schema/List"/>
   <sch:ns prefix="text" uri="http://www.hsfr.org.uk/Schema/Text"/>
   <sch:ns prefix="i18n" uri="http://apache.org/cocoon/i18n/2.1"/>
   <sch:ns prefix="pf" uri="http://www.paloose.org/schemas/Forms/1.0"/>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:h2>PForms Definition</xhtml:h2>
 
   <xhtml:pre>   &lt;pf:form id="addUserForm" flow="addUser" continuation="{flow:continuation.id}" session="{flow:__flowId}">
      ...
   &lt;/pf:form>
   </xhtml:pre>
   
   <define name="paloose.forms">
      <element name="pf:form">
         <optional><attribute name="id"/></optional>
         <attribute name="flow"/>
         <attribute name="session"/>
         <attribute name="continuation"/>
         <optional>
            <ref name="paloose.forms.label"/>
         </optional>
         <optional>
            <ref name="paloose.forms.label"/>
         </optional>
         <interleave>
            <zeroOrMore><ref name="paloose.forms.group"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.input"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.secret"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.output"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.select"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.submit"/></zeroOrMore>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre>   &lt;pf:group ref="address">
      &lt;pf:label>Address&lt;/pf:label>
      &lt;pf:output ref="address-line_1">
      &lt;pf:label>Line 1&lt;/pf:label>
      &lt;pf:value>{flow:address-line_1}&lt;/pf:value>
      &lt;/pf:output>
      &lt;pf:output ref="address-line_2">
      &lt;pf:label>Line 2&lt;/pf:label>
      &lt;pf:value>{flow:address-line_2}&lt;/pf:value>
      &lt;/pf:output>
      &lt;pf:output ref="address-postcode">
      &lt;pf:label>Postcode&lt;/pf:label>
      &lt;pf:value>{flow:address-postcode}&lt;/pf:value>
      &lt;/pf:output>
      &lt;/pf:group></xhtml:pre>
   
   <define name="paloose.forms.group">
      <element name="pf:group">
         <optional><attribute name="ref"/></optional>
         <optional><ref name="paloose.forms.label"/></optional>
         <interleave>
            <zeroOrMore><ref name="paloose.forms.group"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.input"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.output"/></zeroOrMore>
            <zeroOrMore><ref name="paloose.forms.select"/></zeroOrMore>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre></xhtml:pre>
   
   <define name="paloose.forms.select">
      <element name="pf:select">
         <optional><attribute name="ref"/></optional>
         <optional><attribute name="appearance"/></optional>
         <optional><ref name="paloose.forms.label"/></optional>
         <ref name="paloose.forms.value"/>
         <zeroOrMore><ref name="paloose.forms.choices"/></zeroOrMore>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre></xhtml:pre>
   
   <define name="paloose.forms.choices">
      <element name="pf:choices">
         <zeroOrMore><ref name="paloose.forms.item"/></zeroOrMore>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre></xhtml:pre>
   
   <define name="paloose.forms.item">
      <element name="pf:item">
         <optional><attribute name="class"/></optional>
         <interleave>
            <optional><ref name="paloose.forms.label"></ref></optional>
            <optional><ref name="paloose.forms.hint"></ref></optional>
            <ref name="paloose.forms.value"></ref>
            <optional><ref name="paloose.forms.help"></ref></optional>
            <optional><ref name="paloose.forms.violations"></ref></optional>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre>   &lt;pf:submit class="button" id="prev">
      &lt;pf:label>Back&lt;/pf:label>
      &lt;pf:hint>Go to previous page&lt;/pf:hint>
   &lt;/pf:submit></xhtml:pre>
   
   <define name="paloose.forms.submit">
      <element name="pf:submit">
         <attribute name="class"/>
         <attribute name="id"/>
         <interleave>
            <optional><ref name="paloose.forms.label"/></optional>
            <optional><ref name="paloose.forms.hint"/></optional>
            <optional><ref name="paloose.forms.value"/></optional>
            <optional><ref name="paloose.forms.help"/></optional>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre>   &lt;pf:input ref="email" class="fullnameField">
      &lt;pf:label>EMAIL&lt;/pf:label>
      &lt;pf:value>{flow:email}&lt;/pf:value>
      &lt;pf:hint>The user's EMAIL for contact&lt;/pf:hint>
      &lt;pf:violations/>
      &lt;/pf:input></xhtml:pre>
   
   <define name="paloose.forms.input">
      <element name="pf:input">
         <attribute name="ref"/>
         <optional><attribute name="class"/></optional>
         <interleave>
            <optional><ref name="paloose.forms.label"></ref></optional>
            <optional><ref name="paloose.forms.hint"></ref></optional>
            <ref name="paloose.forms.value"></ref>
            <optional><ref name="paloose.forms.help"></ref></optional>
            <optional><ref name="paloose.forms.violations"></ref></optional>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre>   &lt;pf:secret ref="email" class="fullnameField">
      &lt;pf:label>EMAIL&lt;/pf:label>
      &lt;pf:value>{flow:email}&lt;/pf:value>
      &lt;pf:hint>The user's EMAIL for contact&lt;/pf:hint>
      &lt;pf:violations/>
      &lt;/pf:input></xhtml:pre>
   
   <define name="paloose.forms.secret">
      <element name="pf:secret">
         <attribute name="ref"/>
         <optional><attribute name="class"/></optional>
         <interleave>
            <optional><ref name="paloose.forms.label"></ref></optional>
            <optional><ref name="paloose.forms.hint"></ref></optional>
            <ref name="paloose.forms.value"></ref>
            <optional><ref name="paloose.forms.help"></ref></optional>
            <optional><ref name="paloose.forms.violations"></ref></optional>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:pre>   &lt;pf:output ref="username">
      &lt;pf:label>Username:&lt;/pf:label>
      &lt;pf:value>{flow:username}&lt;/pf:value>
   &lt;/pf:output></xhtml:pre>
   
   <define name="paloose.forms.output">
      <element name="pf:output">
         <attribute name="ref"/>
         <optional><attribute name="class"/></optional>
         <interleave>
            <optional><ref name="paloose.forms.label"></ref></optional>
            <optional><ref name="paloose.forms.hint"></ref></optional>
            <ref name="paloose.forms.value"></ref>
            <optional><ref name="paloose.forms.help"></ref></optional>
         </interleave>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <define name="paloose.forms.value">
      <element name="pf:value">
         <optional><attribute name="ref"/></optional>
         <text/>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <define name="paloose.forms.label">
      <element name="pf:label">
         <text/>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <define name="paloose.forms.hint">
      <element name="pf:hint">
         <text/>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <define name="paloose.forms.help">
      <element name="pf:help">
         <text/>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:h2>Violations</xhtml:h2>
   
   <xhtml:p>This will be expanded during th flow through so should be empty &#x2014; it is merely a placeholder.</xhtml:p>
   
   <define name="paloose.forms.violations">
      <element name="pf:violations">
         <empty/>
      </element>
   </define>
   
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
   
   <xhtml:h2>Vertical Content Extension</xhtml:h2>
   
   <define name="text.verticalContent" combine="interleave">
      <zeroOrMore>
         <ref name="paloose.forms"/>
      </zeroOrMore>
   </define>
   
</grammar>
