Created
March 2, 2016 18:09
-
-
Save avernet/1b46bff60ee3f72e5aee to your computer and use it in GitHub Desktop.
Published form with section template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:saxon="http://saxon.sf.net/" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> | |
<xh:head> | |
<xh:title>Untitled Form</xh:title> | |
<xf:model id="fr-form-model" xxf:expose-xpath-types="true"> | |
<!-- Main instance --> | |
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all"> | |
<form> | |
<section-3> | |
<control-1/> | |
</section-3> | |
</form> | |
</xf:instance> | |
<!-- Bindings --> | |
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> | |
<xf:bind id="section-3-bind" ref="section-3" name="section-3"/> | |
</xf:bind> | |
<!-- Metadata --> | |
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all"> | |
<metadata> | |
<application-name>my-app</application-name> | |
<form-name>my-form</form-name> | |
<title xml:lang="en">Untitled Form</title> | |
<description xml:lang="en"/> | |
<singleton>false</singleton> | |
</metadata> | |
</xf:instance> | |
<!-- Attachments --> | |
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all"> | |
<attachments> | |
<css mediatype="text/css" filename="" size=""/> | |
<pdf mediatype="application/pdf" filename="" size=""/> | |
</attachments> | |
</xf:instance> | |
<!-- All form resources --> | |
<!-- Don't make readonly by default in case a service modifies the resources --> | |
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all"> | |
<resources> | |
<resource xml:lang="en"> | |
<section-3> | |
<label/> | |
<help/> | |
</section-3> | |
</resource> | |
</resources> | |
</xf:instance> | |
<!-- Utility instances for services --> | |
<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:model> | |
<xbl:xbl xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:component="http://orbeon.org/oxf/xml/form-builder/component/my-app/library"> | |
<xbl:binding id="my-app-my-section-template-component" element="component|my-section-template" class="fr-section-component"> | |
<xbl:implementation> | |
<xf:model id="my-section-template-model"> | |
<xf:instance id="fr-form-instance" xxbl:mirror="true"> | |
<empty/> | |
</xf:instance> | |
<xf:instance id="fr-form-template"> | |
<my-section-template> | |
<control-1/> | |
</my-section-template> | |
</xf:instance> | |
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> | |
<xf:bind id="control-1-bind" name="control-1" ref="control-1" xxf:whitespace="trim"/> | |
</xf:bind> | |
<xf:instance id="fr-form-resources"> | |
<resources> | |
<resource xml:lang="en"> | |
<my-section-template> | |
<label>My section template</label> | |
</my-section-template> | |
<control-1> | |
<label/> | |
<hint/> | |
<alert/> | |
</control-1> | |
</resource> | |
</resources> | |
</xf:instance> | |
<xf:instance id="readonly"> | |
<readonly/> | |
</xf:instance> | |
<xf:var name="fr-params" value="xxf:instance('fr-parameters-instance')"/> | |
<xf:var name="fr-mode" value="$fr-params/mode"/> | |
<xf:bind ref="instance('fr-form-instance')" readonly="$fr-mode = ('view', 'pdf', 'email') or instance('readonly') = 'true' or ($fr-params/app = 'orbeon' and $fr-params/form = 'builder')"/> | |
<xf:action event="xforms-model-construct-done" class="fr-design-time-preserve"> | |
<xf:action if="empty(instance()/*)"> | |
<xf:insert context="instance()" origin="instance('fr-form-template')/*"/>> | |
<xf:rebuild/> | |
<xf:recalculate xxf:defauls="true"/> | |
<xf:revalidate/> | |
</xf:action> | |
</xf:action> | |
</xf:model> | |
</xbl:implementation> | |
<xbl:template> | |
<xf:var name="context" id="context" value="xxf:binding-context('my-app-my-section-template-component')"/> | |
<xf:var name="readonly" as="xs:boolean" value="exf:readonly($context)"> | |
<xf:setvalue event="xforms-enabled xforms-value-changed" ref="instance('readonly')" value="exf:readonly($context)" class="fr-design-time-preserve"/> | |
</xf:var> | |
<xf:var name="fr-resources" as="element()?"> | |
<xxf:value value="$fr-resources" xxbl:scope="outer"/> | |
</xf:var> | |
<xf:var name="form-resources" value="instance('fr-form-resources')/(resource[@xml:lang = xxf:instance('fr-language-instance')], resource[1])[1]" as="element(resource)"/> | |
<xf:group appearance="xxf:internal"> | |
<xf:label xmlns:oxf="http://www.orbeon.com/oxf/processors" ref="$form-resources/my-section-template/label"/> | |
<fr:grid xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<xh:tr> | |
<xh:td> | |
<xf:input id="control-1-control" bind="control-1-bind"> | |
<xf:label ref="$form-resources/control-1/label"/> | |
<xf:hint ref="$form-resources/control-1/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</xf:input> | |
</xh:td> | |
<xh:td/> | |
</xh:tr> | |
</fr:grid> | |
</xf:group> | |
</xbl:template> | |
</xbl:binding> | |
</xbl:xbl> | |
</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-3-control" bind="section-3-bind"> | |
<xf:label ref="$form-resources/section-3/label"/> | |
<component:my-section-template xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder" xmlns:component="http://orbeon.org/oxf/xml/form-builder/component/my-app/library" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"/> | |
</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