Skip to content

Instantly share code, notes, and snippets.

@avernet
Last active January 9, 2019 22:05
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 avernet/64fec00159782506be4a9ed36b35136f to your computer and use it in GitHub Desktop.
Save avernet/64fec00159782506be4a9ed36b35136f to your computer and use it in GitHub Desktop.
Test case for "natural" vs. "full" fields width
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
fr:data-format-version="4.0.0">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<control-1/>
<control-2/>
<control-3/>
<control-4/>
<control-5/>
<control-6/>
<control-7/>
<control-8/>
<control-9/>
<control-10/>
<control-11/>
<control-12/>
</section-1>
</form>
</xf:instance>
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-2-bind" ref="control-2" name="control-2" type="xf:decimal"/>
<xf:bind id="control-1-bind" ref="control-1" name="control-1" type="xf:decimal"/>
<xf:bind id="control-3-bind" ref="control-3" name="control-3" type="xf:decimal"
constraint="xxf:fraction-digits(2)"/>
<xf:bind id="control-4-bind" ref="control-4" name="control-4" type="xf:decimal"
constraint="xxf:fraction-digits(2)"/>
<xf:bind id="control-5-bind" ref="control-5" name="control-5" type="xf:date"/>
<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:time"/>
<xf:bind id="control-9-bind" ref="control-9" name="control-9" type="xf:dateTime"/>
<xf:bind id="control-10-bind" ref="control-10" name="control-10" type="xf:dateTime"/>
<xf:bind id="control-11-bind" ref="control-11" name="control-11"
constraint=". = '' or matches(., '^\d{10}$')"/>
<xf:bind id="control-12-bind" ref="control-12" name="control-12"
constraint=". = '' or matches(., '^\d{10}$')"/>
</xf:bind>
</xf:bind>
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>a</application-name>
<form-name>a</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
<created-with-version>2017.2-SNAPSHOT PE</created-with-version>
<updated-with-version>2017.2-SNAPSHOT PE</updated-with-version>
</metadata>
</xf:instance>
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<control-1>
<label>Number full</label>
<hint/>
</control-1>
<section-1>
<label>Untitled Section</label>
</section-1>
<control-2>
<label>Number natural</label>
<hint/>
</control-2>
<control-3>
<label>Currency full</label>
<hint/>
</control-3>
<control-4>
<label>Currency natural</label>
<hint/>
</control-4>
<control-5>
<label>Date full</label>
<hint/>
</control-5>
<control-6>
<label>Date natural</label>
<hint/>
</control-6>
<control-7>
<label>Time full</label>
<hint/>
</control-7>
<control-8>
<label>Time natural</label>
<hint/>
</control-8>
<control-9>
<label>Date time full</label>
<hint/>
</control-9>
<control-10>
<label>Date time natural</label>
<hint/>
</control-10>
<control-11>
<label>Phone full</label>
<hint/>
</control-11>
<control-12>
<label>Phone natural</label>
<hint/>
</control-12>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid">
<fr:c y="1" x="1" w="6">
<fr:number xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:NumberSupport="java:org.orbeon.xbl.NumberSupportJava"
id="control-1-control"
bind="control-1-bind"
field-width="full">
<xf:label ref="$form-resources/control-1/label"/>
<xf:hint ref="$form-resources/control-1/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:number>
</fr:c>
<fr:c y="1" x="7" w="6">
<fr:number xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:NumberSupport="java:org.orbeon.xbl.NumberSupportJava"
id="control-2-control"
bind="control-2-bind"
field-width="natural">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:number>
</fr:c>
<fr:c x="1" y="2" w="6">
<fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="control-3-control"
bind="control-3-bind"
field-width="full">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:currency>
</fr:c>
<fr:c x="7" y="2" w="6">
<fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="control-4-control"
bind="control-4-bind"
field-width="natural">
<xf:label ref="$form-resources/control-4/label"/>
<xf:hint ref="$form-resources/control-4/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:currency>
</fr:c>
<fr:c x="1" y="3" w="6">
<fr:date xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-5-control"
bind="control-5-bind"
field-width="full">
<xf:label ref="$form-resources/control-5/label"/>
<xf:hint ref="$form-resources/control-5/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:date>
</fr:c>
<fr:c x="7" y="3" w="6">
<fr:date xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-6-control"
bind="control-6-bind"
field-width="natural">
<xf:label ref="$form-resources/control-6/label"/>
<xf:hint ref="$form-resources/control-6/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:date>
</fr:c>
<fr:c x="1" y="4" w="6">
<fr:time xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-7-control"
bind="control-7-bind"
field-width="full">
<xf:label ref="$form-resources/control-7/label"/>
<xf:hint ref="$form-resources/control-7/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:time>
</fr:c>
<fr:c x="7" y="4" w="6">
<fr:time xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-8-control"
bind="control-8-bind"
field-width="natural">
<xf:label ref="$form-resources/control-8/label"/>
<xf:hint ref="$form-resources/control-8/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:time>
</fr:c>
<fr:c x="1" y="5" w="6">
<fr:datetime xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-9-control"
bind="control-9-bind"
field-width="full">
<xf:label ref="$form-resources/control-9/label"/>
<xf:hint ref="$form-resources/control-9/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:datetime>
</fr:c>
<fr:c x="7" y="5" w="6">
<fr:datetime xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-10-control"
bind="control-10-bind"
field-width="natural">
<xf:label ref="$form-resources/control-10/label"/>
<xf:hint ref="$form-resources/control-10/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:datetime>
</fr:c>
<fr:c x="1" y="6" w="6">
<fr:us-phone xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="control-11-control"
bind="control-11-bind"
field-width="full">
<xf:label ref="$form-resources/control-11/label"/>
<xf:hint ref="$form-resources/control-11/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:us-phone>
</fr:c>
<fr:c x="7" y="6" w="6">
<fr:us-phone xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="control-12-control"
bind="control-12-bind"
field-width="natural">
<xf:label ref="$form-resources/control-12/label"/>
<xf:hint ref="$form-resources/control-12/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:us-phone>
</fr:c>
</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