Skip to content

Instantly share code, notes, and snippets.

@ebruchez
Last active December 20, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebruchez/6187690 to your computer and use it in GitHub Desktop.
Save ebruchez/6187690 to your computer and use it in GitHub Desktop.
Library form acme/library for Orbeon Forms testing
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0">
<xh:head>
<xh:title>ACME library</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="fr-form-instance">
<form>
<s1>
<code/>
<phone/>
<languages/>
</s1>
<s2>
<r1>
<control-6/>
<control-7/>
<control-8/>
</r1>
</s2>
</form>
</xf:instance>
<xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
ref="instance('fr-form-instance')">
<xf:bind id="s1-bind" name="s1" ref="s1">
<xf:bind id="phone-bind" ref="phone" name="phone"
constraint=". = '' or matches(., '^\d{10}$')"
relevant="$code = 42"/>
<xf:bind id="code-bind" ref="code" name="code" type="xf:decimal"/>
<xf:bind id="languages-bind" ref="languages" name="languages"/>
</xf:bind>
<xf:bind id="s2-bind" ref="s2" name="s2">
<xf:bind id="r1-bind" ref="r1" name="r1">
<xf:bind id="control-6-bind" ref="control-6" name="control-6" type="xf:date"/>
<xf:bind id="control-7-bind" ref="control-7" name="control-7" type="xf:time"/>
<xf:bind id="control-8-bind" ref="control-8" name="control-8" type="xf:dateTime"/>
</xf:bind>
</xf:bind>
</xf:bind>
<xf:instance xxf:readonly="true" id="fr-form-metadata">
<metadata>
<application-name>acme</application-name>
<form-name>library</form-name>
<title xml:lang="en">ACME library</title>
<description xml:lang="en"/>
<title xml:lang="fr">ACME library</title>
<description xml:lang="fr"/>
</metadata>
</xf:instance>
<xf:instance id="fr-form-attachments">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<xf:instance id="fr-form-resources" xxf:readonly="false">
<resources>
<resource xml:lang="en">
<code>
<label>Code</label>
<hint/>
</code>
<control-6>
<label>Date</label>
<hint/>
</control-6>
<control-7>
<label>Time</label>
<hint/>
</control-7>
<control-8>
<label>Date and Time</label>
<hint/>
</control-8>
<s1>
<label>S1</label>
</s1>
<s2>
<label>S2</label>
<help/>
</s2>
<phone>
<label>Phone</label>
<hint/>
</phone>
<languages>
<item>
<label>First choice</label>
<value>one</value>
</item>
<item>
<label>Second choice</label>
<value>two</value>
</item>
<item>
<label>Third choice</label>
<value>three</value>
</item>
<label/>
<hint/>
</languages>
</resource>
<resource xml:lang="fr">
<code>
<label>Code fr</label>
<hint/>
</code>
<control-6>
<label>Date fr</label>
<hint/>
</control-6>
<control-7>
<label>Time fr</label>
<hint/>
</control-7>
<control-8>
<label>Date and Time fr</label>
<hint/>
</control-8>
<s1>
<label>S1 fr</label>
</s1>
<s2>
<label>S2 fr</label>
<help/>
</s2>
<phone>
<label>Phone fr</label>
<hint/>
</phone>
<languages>
<item>
<label>First choice</label>
<value>one</value>
</item>
<item>
<label>Second choice</label>
<value>two</value>
</item>
<item>
<label>Third choice</label>
<value>three</value>
</item>
<label>Languages</label>
<hint/>
</languages>
</resource>
</resources>
</xf:instance>
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
<xf:instance xxf:readonly="true" id="r1-template">
<r1>
<control-6/>
<control-7/>
<control-8/>
</r1>
</xf:instance>
<xf:instance id="load-languages-instance" class="fr-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:frf="java:org.orbeon.oxf.fr.FormRunner"
xmlns:secure="java:org.orbeon.oxf.util.SecureUtils"
xmlns:version="java:org.orbeon.oxf.common.Version"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder">&lt;foo/&gt;</body>
</xf:instance>
<xf:submission id="load-languages-submission" class="fr-service"
ref="instance('fr-service-request-instance')"
resource="oxf:/apps/fr/i18n/languages.xml"
method="get"
serialization="application/xml"
mediatype="application/xml"
replace="instance"
instance="fr-service-response-instance"/>
<xf:action id="set-languages-binding">
<xf:action ev:event="xforms-ready" ev:observer="fr-form-model" if="true()">
<xf:send submission="load-languages-submission"/>
</xf:action>
<xf:action ev:event="xforms-submit" ev:observer="load-languages-submission">
<xf:var name="request-instance-name" value="'load-languages-instance'" as="xs:string"/>
<xf:insert ref="instance('fr-service-request-instance')"
origin="saxon:parse(instance($request-instance-name))"/>
<xf:action context="instance('fr-service-request-instance')"/>
</xf:action>
<xf:action ev:event="xforms-submit-done" ev:observer="load-languages-submission"
context="instance('fr-service-response-instance')">
<xf:action class="fr-itemset-action">
<xf:var name="control-name" value="'languages'"/>
<xf:var name="response-items" value="/*/language"/>
<xf:var name="item-label" value="@english-name"/>
<xf:var name="item-value" value="@code"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline">
<fr:section id="s1-control" bind="s1-bind">
<xf:label ref="$form-resources/s1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:number xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="code-control"
bind="code-bind">
<xf:label ref="$form-resources/code/label"/>
<xf:hint ref="$form-resources/code/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:number>
</xh:td>
<xh:td>
<fr:us-phone xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="phone-control"
bind="phone-bind">
<xf:label ref="$form-resources/phone/label"/>
<xf:hint ref="$form-resources/phone/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:us-phone>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:select1 id="languages-control" appearance="minimal" bind="languages-bind">
<xf:label ref="$form-resources/languages/label"/>
<xf:hint ref="$form-resources/languages/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:item>
<xf:label>[Select...]</xf:label>
<xf:value/>
</xf:item>
<xf:itemset ref="$form-resources/languages/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
<xh:td/>
</xh:tr>
</fr:grid>
</fr:section>
<fr:section id="s2-control" bind="s2-bind">
<xf:label ref="$form-resources/s2/label"/>
<fr:grid id="r1-control" repeat="true" bind="r1-bind" origin="instance('r1-template')"
min="1">
<xh:tr>
<xh:td>
<xf:input id="control-6-control" bind="control-6-bind">
<xf:label ref="$form-resources/control-6/label"/>
<xf:hint ref="$form-resources/control-6/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="control-7-control" bind="control-7-bind">
<xf:label ref="$form-resources/control-7/label"/>
<xf:hint ref="$form-resources/control-7/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="control-8-control" bind="control-8-bind">
<xf:label ref="$form-resources/control-8/label"/>
<xf:hint ref="$form-resources/control-8/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment