xforms:outputAdded by IBM on August 8, 2013 | Version 1 (Original)
|Links a button or a label to information in the XForms data model. This allows you to display images or text from the data model on the face of a button or label.
If you use this to link to an image in the data model, that image must be base64 encoded.
Table 1. xforms output parameter
<xforms:output single_node_binding value="XPath" mediatype="MIME type">
|single node binding||string||Optional. See Single node binding.|
|XPath||XPath||Optional. An XPath reference that sets the value for the output. This is useful for performing simple calculations on one or more data elements. For example, you might add two data elements together.
The XPath reference is evaluated relative to the root node of the default instance. If a single node binding is provided, this attribute is ignored.
|MIME type||string||Required when using images in button items or label items. Also required when using the richtext item.
For images, the value must be image/*.
For the richtext item, the value must be text/html.
|label text||string||Sets the text for the value option of the button or label, as well as the accessibility message for the item. Although the xforms:label tag must appear, you can use an empty string if you do not want to set the label.
If the item also has an acclabel option, it will override this setting.|
|Alert, Hint, Help Setting||metadata||See Metadata sub-options.|
Available in label, richtext
Example The following example shows a label that uses the xforms:output option to link it to a total that is calculated in the data model. The label will then use this data as its value, and display it to the user.
- Images in the data model must be base64 encoded before they can be linked with the xforms:output option.
- The xforms:label is optional in an xforms:output. If provided, the value of the xforms:output is prepended to the text from the single node binding of the xforms:output (if it has one). The concatenated value is then displayed by the XFDL label (unless the label displays an image).
- Right justification affects only the text provided by the xforms:output. Any text provided by an xforms:label is left justified.
- The text provided by xforms:label does not affect the XFDL value option. Only data obtained by the single node binding to the xforms:output is placed in the XFDL value. This means that the format option settings are applied to the xforms:output text, but not the xforms:label text. This allows you to create a leading label for other values, such as currency types.
- Although xforms:output cannot be the immediate child of an XFDL button item, it can appear as a descendent through the xforms:trigger, xforms:submit, or xforms:upload options.
- The image MIME type variant can also be used in the xforms:label of an xforms:trigger option or an xforms:submit option in a button item.
- The value attribute can reference data in a non-default model if you wrap the xforms:output in an xforms:group and bind the group to the data model you want to reference. For example, the following sample shows how to add the values of 2 nodes in the non-default model:
<xforms:group model="x" ref="/data">
<xforms:output value="a + b"/>