The past week I have been working on customizing the layout of a radio group. Such a group consists of multiple ‘buttons’ of which at most one can be selected at any time.
The output format of our forms is xforms, which is an XML format to describe interactive forms. Such a form is interpreted and handle by a xform engine, which is Orbeon in our case.
In xforms there is a select1 element which handles radio buttons perfectly. There is only one downside, it does not allow any styling beyond that what is capable with CSS. Though Orbeon often adds features to xforms, it has nothing to overcome these limitations at the moment.
That means it was up to us to find a way to workout the shortcomings of xforms.
The past few weeks I have been working enabling data formatting of input fields in Orbeon. Orbeon has a custom element that can be used to unformat and format input fields. It only made sense to use these elements such that formatting is handled by Orbeon itself.
The values for these elements must be XPath expressions which will be evaluated at run-time by Orbeon. The complexity comes from the fact that a huge variety of data formats has to be supported, as the formats customers can use is kept very open.
This means we will need to generate a XPath expression that will interpret the format-string and translate the input at runtime, which is done with XSLT. The expression itself has to be known when the form is deployed and thus is static. This has to be done for a couple of supported data types, which can be divided into three groups: “String”, “Decimal” and “Date/Time”.