Orbeon Forms
  • Getting started
  • Installation
    • Logging
    • Configuration banner
    • Docker
    • Azure
    • Tomcat
    • WildFly
    • WebSphere
    • WebLogic
    • GlassFish
    • Caches
    • Replication
    • Upgrading
  • Configuration
    • Properties
      • General
        • HTTP client
      • Form Runner
        • Detail page
          • Attachments
          • Email properties
          • PDF
          • Table of contents
        • Persistence
        • Summary page
      • Form Builder
      • XForms
    • Advanced
      • Workflows
      • Session management
      • State handling
      • Client-side error handling
      • Clustering and High Availability
      • Configuring a Form Runner eXist database
      • Creating a production WAR
      • Environments
      • JavaScript and CSS assets
      • Limiter filter
      • Run modes
      • Security
        • Content-Security-Policy header
      • SAP Hybris Module
      • XForms logging
    • Troubleshooting
      • Troubleshooting with the orbeon.log
      • Memory and threads
      • Relational database logging
      • Misc
  • Form Builder
    • Form settings
      • Time window
    • Form editor
      • Form area
      • Toolbox
      • Buttons bar
      • Control settings
      • Dependent fields and sections
      • Validation
      • Choices editor
      • Publishing
      • Cut, copy and paste
      • Section and grid settings
      • Section settings
      • Grid settings
      • Quick control search
      • Repeat settings
      • Repeated grids
      • Undo and redo
      • Keyboard shortcuts
    • Formulas
      • Examples of formulas
      • Formulas inspector
      • Formulas console
    • Summary page
    • Form localization
    • Advanced
      • Edit source
      • Services and actions
        • HTTP services
        • Database services
        • Simple Actions
        • Action Syntax
        • Action Syntax examples
        • Synchronizing repeated content
      • Testing a form in web mode
      • Testing PDF production
      • Testing offline functionality
      • Email Settings dialog
      • Field-level encryption
      • Messages
      • Section templates
      • Template syntax
      • XML Schemas support
      • Extensibility
        • Extension API
        • Integration
        • Toolbox component metadata
  • Form Runner
    • Overview
      • Terminology
    • Pages
      • Landing page
      • Published Forms page
      • Forms Admin page
      • Summary page
    • Components
      • Alert dialog
      • Attachment
      • Autocomplete
      • Captcha
      • Character counter
      • Checkbox input
      • Currency
      • Date
      • Dropdown date
      • Static and dynamic dropdown
      • Error summary
      • Grid
      • Handwritten signature
      • Hidden field
      • Image
      • Image annotation
      • Image attachment
      • Number
      • Open selection
      • Repeater
      • Formatted Text / Rich Text Editor
      • Section
      • Single-selection tree
      • Source code editor
      • Time
      • US phone
      • US state
      • Video
      • Video attachment
      • Wizard
      • XForms inspector
      • Yes/No answer
    • Features
      • Automatic calculations dependencies
      • Datasets
      • Excel and XML import
      • Excel and XML export
      • Summary page Excel Export
      • Form definitions and form data Zip Export
      • Purging historical data
      • Lease
      • Localization
      • Supported languages
      • Mobile support
      • Multitenancy
      • Form Runner navigation bar
      • PDF production
        • Automatic PDF
        • Automatic PDF header and footer configuration
        • PDF templates
      • Responsive design
      • Revision history
      • S3 storage
      • Simple data migration
      • TIFF production
      • Versioning
      • Wizard view
      • Workflow stage
    • Persistence
      • Using a relational database
      • Relational database schema
      • Purging old data using SQL
      • Auditing
      • Autosave
      • Database support
      • Flat view
    • Linking and embedding
      • Linking
      • Java Embedding API
      • JavaScript Embedding API
      • Liferay full portlet
      • Liferay proxy portlet
      • Securing Form Runner access
      • Form Runner offline embedding API
      • Angular component
      • React component
    • Access control and permissions
      • Users
      • Login & Logout
      • Deployed forms
      • Form fields
      • Editing forms
      • Owner and group member
      • Organizations
      • Scenarios
      • Token-based permissions
    • Styling
      • CSS
      • Grids CSS
      • Automatic PDF styling and CSS
    • APIs
      • Authentication of server-side service APIs
      • Persistence API
        • CRUD API
        • Search API
        • List form data attachments API
        • Form Metadata API
        • Lease API
        • Reindexing API
        • Caching
        • Versioning
        • Revision History API
        • Zip Export API
        • Custom persistence providers
      • Other APIs
        • Connection context API
        • Duplicate form data API
        • File scan API
        • Form Runner JavaScript API
        • Generate XML Schema API
        • PDF API
        • Publish form definition API
        • Run form in the background API
      • Data formats
        • Form data
        • Date and time
        • Form definition
    • Architecture and integration
      • Architecture
      • Access form data
      • Integration
    • Advanced
      • Buttons and processes
        • Simple process syntax
        • Core actions
        • Form Runner actions
          • Save action
          • Send action
          • Email action
        • XForms actions
        • Predefined buttons, processes and dialogs
        • Summary page buttons and processes
      • Custom dialogs/model logic
      • Services
      • Singleton form
      • Monitoring HTTP requests
  • XForms
    • Core
      • Attribute Value Templates (AVTs)
      • Binds
      • Validation
      • Variables
      • Keyboard focus
      • XForms JavaScript API
      • Error handling
        • Detailed behavior
      • Model-Bind variables
      • XForms 2.0 support
    • Events
      • Standard support
      • UI refresh events
      • Keyboard events
      • Extension events
      • Extension context information
      • Other event extensions
    • Actions
      • Repeat, insert and delete
      • Scripting actions
      • Extensions
    • Controls
      • Label, hint, help
      • Input
      • Output
      • Text area
      • Button
      • Upload
      • Dialog
    • Submission
      • Standard support
      • JSON support
      • Asynchronous submissions
      • Caching extension
      • Other submission extensions
    • XPath
      • Type annotations
      • Expression analysis
      • Tips
      • Compatibility
      • Standard functions
      • Maps and arrays Functions
      • Extension functions
        • Core functions
        • Utility functions
        • Model functions
        • Controls functions
        • XML functions
        • JSON functions
        • HTTP functions
        • Form Runner functions
        • Other functions
        • Deprecated functions
    • XBL components
      • FAQ
      • Guide
        • XBL Tutorial
        • Bindings
        • XForms models
        • Including content
        • Event handling
        • Conventions
        • Map XBL example
        • Learning from existing components
      • Advanced topics
        • XBL Modes
        • JavaScript companion classes
        • XBL library
        • Extensions
        • Attachment controls
    • XForms tutorial
      • Introduction
      • Installation
      • The Hello application
      • The Bookcast application
        • The basic app
        • Database access
        • Polishing the app
        • Adding a feed
    • Using XForms from Java apps
  • XML Platform
    • Page Flow Controller
      • Basics
      • XML submission
      • Navigating between pages
      • Paths and matchers
      • Other configuration elements
      • Typical combinations of page model and page view
      • Examples
      • Authorizing pages and services
    • Processors
      • URL generator
      • Request generator
      • PDF to image converter
    • Resources
      • Resource managers
      • Setting up an external resources directory
    • Other
      • Binary and text documents
  • FAQ
    • Licensing
    • PE and Dev Support
    • Form Builder and Form Runner
    • Resources and support
    • Other technical questions
  • Contributors
    • Automated tests
    • Building Orbeon Forms
    • Localizing Orbeon Forms
    • Validation functions
    • Contributor License Agreement
  • Release notes
    • Orbeon Forms 2022.1.9
    • Orbeon Forms 2024.1.1
    • Orbeon Forms 2023.1.7
    • Orbeon Forms 2024.1
    • Orbeon Forms 2023.1.6
    • Orbeon Forms 2023.1.5
    • Orbeon Forms 2021.1.11
    • Orbeon Forms 2022.1.8
    • Orbeon Forms 2023.1.4
    • Orbeon Forms 2023.1.3
    • Orbeon Forms 2023.1.2
    • Orbeon Forms 2022.1.7
    • Orbeon Forms 2023.1.1
    • Orbeon Forms 2023.1
    • Orbeon Forms 2022.1.6
    • Orbeon Forms 2021.1.10
    • Orbeon Forms 2022.1.5
    • Orbeon Forms 2021.1.9
    • Orbeon Forms 2022.1.4
    • Orbeon Forms 2022.1.3
    • Orbeon Forms 2021.1.8
    • Orbeon Forms 2022.1.2
    • Orbeon Forms 2022.1.1
    • Orbeon Forms 2022.1
    • Orbeon Forms 2021.1.7
    • Orbeon Forms 2021.1.6
    • Orbeon Forms 2021.1.5
    • Orbeon Forms 2021.1.4
    • Orbeon Forms 2021.1.3
    • Orbeon Forms 2021.1.2
    • Orbeon Forms 2021.1.1
    • Orbeon Forms 2021.1
    • Orbeon Forms 2020.1.6
    • Orbeon Forms 2019.2.4
    • Orbeon Forms 2019.1.2
    • Orbeon Forms 2018.2.5
    • Orbeon Forms 2018.1.4
    • Orbeon Forms 2020.1.5
    • Orbeon Forms 2020.1.4
    • Orbeon Forms 2020.1.3
    • Orbeon Forms 2020.1.2
    • Orbeon Forms 2019.2.3
    • Orbeon Forms 2020.1.1
    • Orbeon Forms 2020.1
    • Orbeon Forms 2019.2.2
    • Orbeon Forms 2019.2.1
    • Orbeon Forms 2019.1.1
    • Orbeon Forms 2019.2
    • Orbeon Forms 2019.1
    • Orbeon Forms 2018.2.4
  • Release history
  • Use cases
  • Product roadmap
  • Index of features
Powered by GitBook
On this page
  • Namespaces
  • Configuration
  • xxbl:container attribute
  • xxbl:attr attribute
  • xbl:template/xxbl:transform attribute
  • xxbl:global element
  • xxbl:mirror attribute
  • xxbl:use-if-attr attribute
  • fr:keep-if-design-time
  • fr:keep-if-param-non-blank
  1. XForms
  2. XBL components
  3. Advanced topics

Extensions

Namespaces

All the generic extensions are in the namespace http://orbeon.org/oxf/xml/xbl, and the usual mapping of this namespace is xmlns:xxbl="http://orbeon.org/oxf/xml/xbl".

Configuration

[SINCE Orbeon Forms 2018.2]

Element filtering can be configured by providing a custom object or class.

The following property allows adding a custom extension XPath function library:

<property 
    as="xs:string" 
    name="oxf.xforms.xbl-support" 
    value="org.orbeon.oxf.fr.xbl.FormRunnerXblSupport"/>

When this property is present, the XForms engine attempts to load an extension XBL support implementation. It does this in two ways:

  1. First, it tries to access a Scala object extending org.orbeon.oxf.xforms.xbl.XBLSupport.

  2. If that fails, it tries to access a Java class and calls a static instance() method on it to obtain an org.orbeon.oxf.xforms.xbl.XBLSupport.

Scala example:

object FormRunnerXblSupport extends XBLSupport {
  
  override def keepElement(
    partAnalysis  : PartAnalysis,
    boundElement  : Element,
    directNameOpt : Option[QName],
    elem          : Element
  ): Boolean = {
    // Implementation here 
    false
  }
}

Java example:

class FormRunnerXblSupport {

    private static XBLSupport _instance = null;

    public static synchronized XBLSupport instance() {
        if (_instance == null)
            _instance = new FormRunnerXblSupport();
        return _instance;
    }
  
    public boolean keepElement(
        PartAnalysis partAnalysis,
        Element boundElement,
        scala.Option<QName> directNameOpt,
        Element elem
    ) {
        // Implementation here
        return false;
    }
}

You can also turn specify this property specifically for a given form by adding an xxf:xbl-support attribute on the first model:

xxf:xbl-support="org.orbeon.oxf.fr.xbl.FormRunnerXblSupport"

xxbl:container attribute

The xxbl:container attribute on xbl:binding allows specifying the name of the HTML element that the XBL binding uses to encapsulate content. By default, this is xh:div. Here is how to change it to xh:span:

<xbl:binding id="my-binding" element="fr|my-binding" xxbl:container="span">

xxbl:attr attribute

The standard xbl:attr attribute does not support accessing attributes other than those positioned exactly on the bound element. This is a serious limitation. The Orbeon Forms implementation adds an extension attribute, xxbl:attr, which takes an XPath expression:

xxbl:attr="xf:alert/(@context | @ref | @bind | @model)"

xbl:template/xxbl:transform attribute

When more flexibility is needed than XBL can provide, the xxbl:transform attribute is your friend.

<xbl:template xxbl:transform="processorName">
    Transformation (inline)
</xbl:template>

Orbeon Forms runs the processor specified by this attribute connecting its config input to the content of the xbl:template and its data input to the bound element and replaces the content of the xbl:template by the data output of the processor. The most frequent expected use is to run XSLT transformations. For instance, to create a widget that alternates styles in table rows within an xf:repeat:

<xbl:binding id="foo-table-alternate" element="foo|table-alternate">
    <xbl:template xxbl:transform="oxf:xslt">
        <xsl:transform version="2.0">
            <xsl:template match="@*|node()">
                <xsl:copy>
                    <xsl:apply-templates select="@*[not(name() = ('style1', 'style2'))]|node()"/>
                </xsl:copy>
            </xsl:template>
            <xsl:template match="foo:table-alternate">
                <xh:table>
                    <xsl:apply-templates select="@*|node()"/>
                </xh:table>
            </xsl:template>
            <xsl:template match="xf:repeat/xh:tr" >
                <xf:var name="position" value="position()"/>
                <xf:group ref=".[$position mod 2 = 1]">
                    <xh:tr xbl:attr="style=style1">
                        <xsl:apply-templates select="@*|node()"/>
                    </xh:tr>
                </xf:group>
                <xf:group ref=".[not($position mod 2 = 1)]">
                    <xh:tr xbl:attr="style=style2">
                        <xsl:apply-templates select="@*|node()"/>
                    </xh:tr>
                </xf:group>
            </xsl:template>
        </xsl:transform>
    </xbl:template>
</xbl:binding>

This component can be invoked through:

<foo:table-alternate class="gridtable" style1="background: red" style2="background: white">
    <xh:tr>
        <xh:th>Label</xh:th>
        <xh:th>Value</xh:th>
    </xh:tr>
    <xf:repeat ref="item">
        <xh:tr>
            <xh:td>
                <xf:output value="@label"/>
            </xh:td>
            <xh:td>
                <xf:output value="@value"/>
            </xh:td>
        </xh:tr>
    </xf:repeat>
</foo:table-alternate>

The xbl:template/@xxbl:transform="oxf:xslt" attribute specifies that its child element (xsl:transform) is considered as an XSLT transformation, runs against the bound element (foo:table-alternate), and the result of this transformation is used as the actual content of the xbl:template.

The result of your transformation will often contain XBL attributes, and in this sample xbl:attr attributes are used to set the style of the rows with: <xh:tr xbl:attr="style=style1">.

The result of the transformation has to be a (well formed) single rooted XML fragment. This might seem obvious, but that means that you might have to encapsulate the sub elements of xbl:template in an XHTML div or span compared to what you would have done if you were not applying a transformation.

The transformation has full access to the bound element and can transform any of its child nodes or attributes. To keep things as encapsulated as possible and not change the behavior of bound elements that are potentially embedded, it is a good practice to define tight transformation templates that affect only the nodes that are meant to be transformed. In the example given above, one might for instance argue that <xsl:template match="foo:table-alternate/xf:repeat/xh:tr"> would be safer than <xsl:template match="xf:repeat/xh:tr">.

You can use <xsl:message terminate="yes"> to report to the user errors that occur during the XSLT transformation. For example:

<xsl:message terminate="yes">Terminating!</xsl:message>

This results in an error will be output in the log, and an error message will show in the browser.

xxbl:global element

The <xxbl:global> element allows an XBL binding to place global markup that is included in a page only once.

<xbl:xbl>
    <xbl:binding element="fr|foo">
        <xxbl:global>
            <!-- The single global dialog -->
            <xxf:dialog id="my-dialog" level="modal" model="my-dialog-model">
                <xf:label>My Global Dialog</xf:label>

                <!-- Dialog model -->
                <xf:model id="my-dialog-model">
                    ...
                </xf:model>

                ...

            </xxf:dialog>
        </xxbl:global>
        <xbl:template>
            ...
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

How this works:

  • The global markup is included at the end of the top-level XForms document, as if you put it there by hand.

  • If the XBL binding is not used, the global markup is not included.

  • Ids on elements in global markup must be made unique by the component author, as those ids become global as well.

The component can dispatch events to global controls if the outer scope is the top-level scope, with the xxbl:scope="outer" attribute. For instance, if in the <xxbl:global> you defined an <xxf:dialog id="my-dialog">, then from within the component, you can run the following action:

<xxf:show dialog="my-dialog" xxbl:scope="outer"/>

NOTE: A future enhancement to this feature might restrict id and XPath scope of global markup to that of the XBL binding.

xxbl:mirror attribute

This attribute, placed on a local XForms instance, tells the XBL engine to automatically mirror changes between that instance and the XBL component's bound node.

For mirroring to work, the XBL component must either:

  • if it has an XPath node binding: be bound to an element node

  • if it doesn't have an XPath node binding: be in the XPath context of an element node (done for compatibility with Form Builder section templates)

At most one instance in a given XBL component may have xxbl:mirror="true".

Lifecycle:

  • when the XBL component becomes relevant

    • the XBL instance is first initialized as usual

    • then if the XBL binding or context points to an element, that element is extracted to become the root element of a new element, which replaces the XBL instance

  • when updates (value changes, inserts, deletes) take place on the XBL instance, these changes are mirrored outside

  • when updates (value changes, inserts, deletes) take place outside, these changes are mirrored on the XBL instance

Example:

<xbl:binding id="fr-gaga" element="fr|gaga" xxbl:mode="binding">
    <xbl:implementation>
        <xf:model id="gaga-model">
            <xf:instance id="gaga-instance" xxbl:mirror="true">
                <empty/>
            </xf:instance>
        </xf:model>
    </xbl:implementation>
</xbl:binding>

xxbl:use-if-attr attribute

[SINCE Orbeon Forms 2018.1]

This attribute allows including a part of the resulting tree only if a particular attribute is present on the bound node.

Example:

<xf:group xxbl:use-if-attr="prefix" class="add-on" ref=".[xxf:non-blank($prefix)]">
    <xf:output value="$prefix"/>
</xf:group>

That xf:group element will ony be included if the bound node contains a non-blank attribute named prefix. Otherwise, the entire subtree will be omitted.

[Orbeon Forms 2018.1 ONLY] This also checks properties such as oxf.xforms.xbl.fr.currency.prefix and if the value of the property is found and not empty, it is as if the attribute was present on the bound node.

In the context of Form Runner, use instead the fr:keep-if-param-non-blank attribute.

fr:keep-if-design-time

[SINCE Orbeon Forms 2018.2]

In the context of Form Runner and Form Builder, this attribute allows including a part of the resulting tree only if the form is shown at design-time or runtime.

The value of the attribute must be either:

  • true: keep the element only if the form is displayed in Form Builder at design-time (this does not include the test mode)

  • false: keep the element only if the form is displayed in Form Runner at runtime (this includes the test mode)

<xbl:template>
    <xh:i class="fa fa-fw fa-eye-slash" fr:keep-if-design-time="true"/>
</xbl:template>

fr:keep-if-param-non-blank

[SINCE Orbeon Forms 2018.2]

In the context of Form Runner, this attribute allows including a part of the resulting tree only if at least one of the following applies:

The value of the attribute is the name of the parameter to check.

  • The specified parameter has a corresponding attribute on the bound node which is present and non-blank.

    • NOTE: This does not evaluate AVTs. Only the static value of the attribute is checked.

  • There is a corresponding form definition metadata element with a non-blank value.

  • There is a corresponding configuration property with the current app name/form name which is present and non-blank.

  • There is a corresponding configuration property without app name/form name which is present and non-blank.

<xf:group fr:keep-if-param-non-blank="prefix" class="add-on" ref=".[xxf:non-blank($prefix)]">
    <xf:output value="$prefix"/>
</xf:group>
PreviousXBL libraryNextAttachment controls

Last updated 2 years ago