Comment on page
An XBL file contains one or more bindings, expressed with the
...binding definition here...
- describes the component's markup and behavior
- determines which XML elements, in the source form, it associates with, in this case elements with qualified name
NOTE: This is CSS syntax to express what in XML you would usually refer to as
acme:multi-tool. It's just that CSS chose as namespace separator
|instead of XML's standard
The binding by element name can be split into two parts:
- This is the namespace prefix.
acmenamespace prefix maps to the namespace URI
http://www.acme.com/xblvia the XML namespace mapping
multi-tool: this is the XML element's local name
NOTE: It is up to you to choose a prefix and namespace URI for your project or company. You can then reuse those for a number of component bindings.
So this binding gives us the pair:
- namespace URI:
- local name:
http://www.acme.com/xblnamespace URI in turn is the key to a standardized namespace prefix defined in properties:
<property as="xs:string" name="oxf.xforms.xbl.mapping.acme">
This is just another way of defining a mapping between a namespace prefix and a namespace URI, except here we do it in a centralized place so that all components using namespace
http://www.acme.com/xblyield the same prefix,
Now let's see where files are located when an element
- 1.Orbeon Forms looks for a property with a name that starts with
oxf.xforms.xbl.mappingand with a value equal to the namespace
http://www.acme.com/xbl. In this case it finds the property
- 2.The XForms engine extracts the part of the property name after
oxf.xforms.xbl.mapping, in this case
- 3.This is used to resolve the resource
- The first part of the path is always
- This is followed by the prefix name, here
- This is followed by a directory with the same name as the local name of your component, containing an XBL file also with the same name, here
acme|multi-toolcomponent, in the same directory. For example:
and so on.
All elements in the
http://orbeon.org/oxf/xml/form-runnernamespace (typically using the prefix
fr, short for "Form Runner") are also handled this way, thanks to a mapping defined as follows:
<property as="xs:string" name="oxf.xforms.xbl.mapping.orbeon">
<fr:number>is loaded from
<fr:section>is loaded from
NOTE: You shouldn't use the
frprefix or the
http://orbeon.org/oxf/xml/form-runnernamespace URI for your own components.
elementattribute specifies, via one or more CSS selectors, which XML elements, in the source form, it associates with. The following CSS selectors are supported:
- by element name
- by element name and XML datatype (Form Builder only)
- by attribute only [SINCE Orbeon Forms 4.9]
- by element name and attribute [SINCE Orbeon Forms 4.9]
The simplest way is to bind by element name:
This means that elements called
fr:numberin the form will use this binding.
Form Builder, at design time only (since Orbeon Forms 4.9), also supports bindings by name and XML datatype:
This must be used on conjunction with a "direct" binding like
In this case an input field (
xf:input) bound to an
xf:decimaltype will be substituted, at design time, with an
[SINCE Orbeon Forms 4.9]
It is possible to associate bindings by:
- attribute only
- or by name and attribute
The following matches elements such as
<fr:character-counter>(by name) but also
<foo:bar appearance="cool character-counter stuff">, because of the
~=operator which means that the attribute is "a list of whitespace-separated values, one of which is exactly equal to"
element="fr|character-counter, [appearance ~= character-counter]"
The following matches elements having the
character-counterappearance and which, at the same time, have the name
element="foo|bar[appearance ~= character-counter]"
[SINCE Orbeon Forms 4.10]
An XBL binding can also be bound to elements in the XForms namespace. For example:
xf|input[appearance ~= character-counter],
xf|textarea[appearance ~= character-counter],
xf|secret[appearance ~= character-counter],
fr|tinymce[appearance ~= character-counter]
This selector associates, for example the following element to the