Syntax 
|
Actions are written in two ways, depending on whether you want to use a group of action or a single action. |
Actions are written in two ways, depending on whether you want to use a group of action or a single action.
When using a group of actions, you place them in an <xforms:action> tag. This groups the actions together, so that the actions all respond to the same trigger event. Once triggered, each action is processed in turn. The following syntax applies:
<xforms:action ev:event="event"
context="context"
if="condition"
while="while-condition"
iterate="for-each" >
<action1 action_settings>
...
<actionn action_settings>
</xforms:action>
Table 1. xforms actions parameters
| Parameter | Type | Description |
| action | string | The specific type of action you want to use. |
| action_setting | string | One or more attributes that sets any values required for the specific action, as well as attributes for any of the parameters below. |
| context | XPath | Optional. Resets the in-scope evaluation context node for other attributes on the xforms:action and other actions within the xforms:action. |
| event | string | This sets the event that will trigger the actions. For more information about events, refer to XForms event handlers. |
| condition | XPath | Optional. An XPath expression that evaluates to either true or false. If false, the actions within the xforms:action tag are not processed. This expression is evaluated relative to the context set by its nearest ancestor with a single node or nodeset binding.
This allows for conditional logic within actions. |
| for-each | XPath | Optional. The actions in the xforms:action are performed once for each node in the nodeset obtained by this expression. The actions are performed in the context of each of the nodes. |
| while-condition | string | Optional. An XPath expression that provides a looping condition for the action This works like a standard while loop expression. While the condition is true, the loop will run. Useful to delete all table rows or copy any number of elements from one parent to another. |
Optionally, you can use only a single action. In this case, no <xforms:action> tag is required, as the triggering event is included on the action's tag. This is written as shown:
<action ev:event="event"
context="context"
if="condition"
while="while-condition"
iterate="for-each" specific_action_settings>
Table 2. xform action parameter
| Parameter | Type | Description |
| action | string | The specific type of action you want to use. |
| context | XPath | Optional. Resets the in-scope evaluation context node for certain other attributes on the action. |
| event | string | This sets the event that will trigger the action. For more information about events, refer to XForms event handlers. |
| condition | XPath | Optional. An XPath expression that evaluates to either true or false. If false, the action is not processed. This expression is evaluated relative to the context set by its nearest ancestor with a single node or nodeset binding, or by the context set by the context attribute.
This allows for conditional logic within actions. |
| for-each | XPath | Optional. The action is performed once for each node in the nodeset obtained by this expression. The actions are performed in the context of each of the nodes. |
| while-condition | string | Optional. An XPath expression that provides a looping condition for the action. This works like a standard while loop expression. While the condition is true, the loop will run. Useful to delete all table rows or copy any number of elements from one parent to another. |
| specific_action_setting | string | One or more attributes that sets any values required for the specific action. |
Note that all actions are in the XForms namespace, and are preceded by the xforms: prefix. Futhermore, all action settings are written as attributes.
|
|
|
|
| Version 1 |
May 2, 2012 |
2:28:17 PM |
by IBM  |
|
|