Skip to content

Instantly share code, notes, and snippets.

@avernet
Last active August 29, 2015 14:25
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/f4ed31e677df98f865a9 to your computer and use it in GitHub Desktop.
Save avernet/f4ed31e677df98f865a9 to your computer and use it in GitHub Desktop.
  • Place the XBL file below the XBL under WEB-INF/resources/xbl/example/first-last/first-last.xbl.
  • Add to properties below to your properties-local.xml. The first is to include the component in Form Builder. The second is so Orbeon Forms knows about the example namespace in which we placed this XBL component. This tells the XForms engine in what directory (it takes the part after oxf.xforms.xbl.mapping. and puts it after xbl, here inferring xbl/example) it can find the component in a given namespace (here http://www.example.com/).
  • In Form Builder, click on the green Reload Toolbox icon.
<property as="xs:string"  
          name="oxf.fb.toolbox.group.custom.*.*.*" 
          value="oxf:/xbl/example/first-last/first-last.xbl"/>
<property as="xs:string"
          name="oxf.xforms.xbl.mapping.example" 
          value="http://www.example.com/"/>
<xbl:xbl 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: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:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
script-type="application/xhtml+xml"
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:ex="http://www.example.com/"
xmlns:odt="http://orbeon.org/oxf/xml/datatypes"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:component="http://orbeon.org/oxf/xml/form-builder/component/faton/library">
<xbl:binding id="first-last" element="ex|first-last" xxbl:mode="lhha binding">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">Full name</display-name>
<description lang="en"/>
<icon lang="en">
<small-icon>/apps/fr/style/images/silk/house.png</small-icon>
<large-icon>/apps/fr/style/images/silk/house.png</large-icon>
</icon>
<templates>
<view>
<ex:first-last>
<xf:label ref=""/>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</ex:first-last>
</view>
</templates>
</metadata>
<xbl:implementation>
<xf:model>
<xf:instance xxbl:mirror="true">
<first-last/>
</xf:instance>
<xf:instance id="template">
<first-last>
<first/>
<last/>
</first-last>
</xf:instance>
<xf:insert event="xforms-model-construct-done" if="empty(instance()/*)"
context="instance()" origin="instance('template')/*"/>
</xf:model>
</xbl:implementation>
<xbl:template>
<xf:input ref="first">
<xf:label>First name</xf:label>
</xf:input>
<xf:input ref="last">
<xf:label>Last name</xf:label>
</xf:input>
</xbl:template>
</xbl:binding>
</xbl:xbl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment