This chapter covers XForms features for combining
All form controls defined in
Element | Attributes | Minimal Content Model |
---|---|---|
label?, (( |
The
the Single Node Binding is expressed and resolves to empty nodeset,
the Single Node Binding is expressed and resolves to a non-relevant instance node,
the
the
All content elements (e.g. form controls, groups, switches, repeats and host language content) within a non-relevant group
are handled as non-relevant. When a xforms-disabled
and then the
XForms action handlers that are listening for events on the non-relevant xforms-enabled
.
Common Attributes:
If a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group.
The optional
Example:
Setting the input focus on a group results in the focus being set to the first form control in the navigation order within that group.
This section defines a switch construct that allows the creation of user interfaces where the user interface can be varied based on user actions and events. The elements and attributes included in this module are:
Element | Attributes | Minimal Content Model |
---|---|---|
|
case+ | |
label?, (( |
||
case? |
This element contains one or more
This is separate from XForms relevant
processing (see
The non-relevance of a switch is determined in the same way as it is for xforms-disabled
and then the
XForms action handlers that are listening for events on the non-relevant xforms-enabled
.
Common Attributes:
Example:
The above results in the portion of the user interface contained in the first case
being displayed initially. This prompts for the user's name; filling in a value and enter
results switches to the alternate case, with a read-only output
rendering. Activating the trigger labeled "Edit" in turn switches back to the original case.
This element encloses markup to be conditionally rendered. The content elements (e.g. form controls,
groups, switches, repeats and host language elements) within a non-selected
Common Attributes:
Special Attributes:
Optional selection status for the case. The default value is "false".
If multiple selected="true"
, the first selected
This XForms Action selects one possible case from an exclusive list of alternatives in a
This action performs the following:
Dispatches an xforms-deselect
event to the currently selected
Adjusts the selected
states (not the attribute values) on the affected cases to reflect the new state of the
Dispatches an xform-select
event to the
Common Attributes:
Special Attributes:
Optional reference to a
The
This section defines a child element of
Element:
Common attributes: None
Special Attributes:
Optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
string
function.
The
Whether the IDREF is obtained from the
The XForms specification allows the definition of repeating structures such as multiple items within a purchase order. When defining the XForms Model, such higher-level collections are constructed out of basic building blocks; similarly, this section defines user interface construct
Element | Attributes | Minimal Content Model |
---|---|---|
(( |
||
label, (value|copy), ( |
||
EMPTY | ||
EMPTY | ||
EMPTY | ||
|
EMPTY | |
(various) | [repeat-nodeset, repeat-bind, repeat-model] (Node Set Binding attributes), repeat-startindex (xsd:positiveInteger), repeat-number (xsd:nonNegativeInteger) | N/A |
This element defines a UI mapping over a
For example:
Common Attributes:
Special Attributes:
Optional 1-based initial value of the repeat index. The default value is 1.
Optional hint to the XForms Processor as to how many elements from the collection to display.
This element operates over a
Element
More generally, there is a need to integrate repeat behavior into host languages at points where the content model of the host language does not or cannot provide the appropriate extension hooks via modularization. To accommodate this, XForms defines an alternative syntax that is functionally equivalent to the
repeat-model
repeat-bind
repeat-nodeset
repeat-startindex
repeat-number
The above attributes are equivalent to the repeat-
. A host language can include these attributes in the appropriate places to enable repeating constructs. For example, a version of XHTML might use:
Which could be validated against an appropriately configured XHTML Schema that includes the XForms Repeat module. Note that what gets repeated is the child elements of the element with the repeat-
attributes.
Additionally, when using XForms Action setindex
, attribute idref
can point to any element carrying the repeat attributes. Similarly, when using function index
against a repeating structure created via the repeat-
attributes, the id
of that element can be used as the argument to function index
.
This element allows the creation of dynamic selections within controls
For each node of the Node Set Binding, an associated
Common Attributes:
Whenever a refresh
event is dispatched the nodeset
is re-evaluated to update the list of available choices.
The following example shows element
Structurally, this element is similar to
Common Attributes:
When an
The target node, selected by the binding attributes on the list form control, must be an element node, otherwise an exception results (
The element node associated with the
A full computational dependency rebuild is done.
When an
The target node, selected by the binding attributes on the list form control, must be an element node, otherwise an exception results (
The child element node associated with the
A full computational dependency rebuild.
The xsd:ID
are modified to remain as unique values in the
instance data after the clones are inserted.
Common Attributes:
Special Attributes:
Optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
If the
Optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
The origin node-set
is the set of one or more nodes to be cloned by the
origin node-set
as described below in the
processing of the
Optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
This attribute is ignored if the Node Set Binding is not specified or specifies an empty node-set.
The insert location node
is a node within the Node Set Binding node-set that is used
to help determine where in the instance to insert each node cloned by the insert
location node
as described below in the processing of the
Optional selector that indicates where to put the cloned node or nodes relative to the insert
location node
. Valid values are before
and after
, and the latter
is the default. This attribute is ignored if the Node Set Binding node-set is not specified or
empty. If the node at the insert location node
within the Node Set Binding node-set is
the document element of an instance, then this attribute is ignored.
Processing for the
The insert context
is determined. If the insert context
is the in-scope evaluation
context. Otherwise, the XPath expression provided by the insert
context
. The insert
context
is the empty node-setinsert context
is not an element
The Node Set Binding node-set is determined. If a insert context
to determine the Node Set Binding node-set. If the Node Set
Binding attributes are not present, then the Node Set Binding node-set is the empty node-set. The
The
The insert context
does not evaluate
to an element node and the Node Set Binding node-set is the empty node-set.
The origin node-set
is determined. If the origin node-set
is the empty node-set.
Otherwise, if the origin node-set
consists of the last node of the Node Set Binding node-set. If the origin node-set
is the result of the evaluation of the insert context
. The origin node-set
is the empty node-set.
The insert location node
is determined. If the Node Set Binding node-set is not specified
or empty, the insert location node
is the insert context
node. Otherwise, if
the insert location node
is the last node
of the Node Set Binding node-set. Otherwise, an insert location node
is determined from the
The evaluation context node is the first node in document order from the Node Set Binding
node-set, the context size is the size of the Node Set Binding node-set, and the context
position is 1
.
The return value is processed according to the rules of the XPath function
round()
. For example, the literal 1.5
becomes 2
, and
the literal 'string'
becomes NaN
.
If the result is in the range 1 to the Node Set Binding node-set size, then the insert
location
is equal to the result. If the result is non-positive, then the insert
location
is 1
. Otherwise, the result is NaN
or exceeds the
Node Set Binding node-set size, so the insert location
is the Node Set Binding
node-set size.
The insert location node
is the node in the Node Set Binding node-set at the
position given by the insert location
.
Each node in the origin node-set
is cloned in the order it appears in the origin node-set
.
The target location
of each
If the cloned node is an attribute, then target location
is the attribute list of either the insert location node
if it is an element or the parent element of the insert location node
if it is not an element.
Otherwise, if insert location node
is the target location
. If there is more than one
cloned node to insert, only the first node that does not cause a conflict is considered.
target location
target location
is before the first attribute of the insert location node
.
If the cloned node is not an attribute, then the target location
insert location node
insert location node
is empty).
Otherwise, if the Node Set Binding node-set is specified and not empty and the type of the
cloned node is different from the type of the insert location node
, the
target location
depends on the node type of the cloned node. If the cloned node is
an attribute, then the target location
is before the first attribute of the
insert location node
. If the cloned node is not an attribute, then the target
location
is before the first child of the insert location node
.
Otherwise, the target location
is immediately before or after the insert
location node
, based on the
The cloned node or nodes are inserted in the order they were cloned at their target
location
depending on their node type. If the target location
was the root element
of an instance, then the cloned node replaces the instance root element. If the cloned node is a
duplicate of another attribute in its parent element, then the duplicate attribute is first removed. If
a cloned node cannot be placed at the target location
due to a node type conflict, then
the insertion for that particular clone node is ignored.
The index for any The change of index on a
The XForms action system's deferred update flags for rebuild, recalculate, revalidate and refresh are set.
The xforms-insert
event with appropriate context information.
This action affects
Generalized append/prepend child can be done with nodeset="*"
for elements and
nodeset="@*"
for attributes.
In each show="true"
is cloned from item[1]
by the item[2]
is selected, and the attribute is created within it because it does not already exist.
Similarly, in the second item[3]
because the cloned node is an attribute.
Since item[3]
already contains a true
.
In the third insert location node
is the existing item[4]
,
but the cloned node is an attribute, so target location
is the attribute list of the parent element (item[4]
) of the
insert location node
. Again, since the item[4]
, it's value is
changed to true. The result of these actions is the following instance data:
When the R
.
This action deletes one or more nodes from instance data.
Common Attributes:
Special Attributes:
Optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
If the delete
action is terminated with no effect. Otherwise, the first node of the
nodeset is used as the new in-scope evaluation context node, and the context position and size are
set to 1. By adjusting the in-scope evaluation context, this attribute affects the evaluation of
subsequent attributes that may appear on
Optional attribute containing an XPath expression evaluated using the Node Set Binding node-set to
determine the delete location
. If the Node Set Binding node-set is empty, then this
attribute is ignored.
Processing for the delete
action is as follows:
The delete context
is determined. It is set to the in-scope evaluation context, possibly
overridden by the delete context
is the empty node-set.
The Node Set Binding node-set is determined. If a delete context
to determine the Node Set Binding node-set. The
The delete location
is determined. If the delete location
. Otherwise, the delete location
is determined by
evaluating the XPath expression specified by the
The evaluation context node is the first node in document order from the Node Set Binding
node-set, the context size is the size of the Node Set Binding node-set, and the context
position is 1
.
The return value is processed according to the rules of the XPath function
round()
. For example, the literal 1.5
becomes 2
, and the
literal 'string'
becomes NaN
.
If the result is in the range 1 to the Node Set Binding node-set size, then the delete
location
is equal to the result. If the result is non-positive, then the delete
location
is 1
. Otherwise, if the result is NaN
or exceeds the
Node Set Binding node-set size, the delete location
is the Node Set Binding
node-set size.
If there is no delete location
, each node in the Node Set Binding node-set is deleted,
except if the node is the root document element of an instance then that particular node is not
deleted. Otherwise, if there is a delete location
, the node at the delete
location
in the Node Set Binding node-set is deleted, except if the node is the root document
element of an instance then that node is not deleted. The delete action is terminated with no effect if
no node is deleted.
The index for any
If, prior to node deletion, the index pointed to a node that is still contained in the collection
after node deletion, the index is adjusted, if necessary, to point to that same node.
Otherwise, when the last remaining node in the collection is removed, the index position
becomes 0
Otherwise, when the index was pointing to one of the deleted nodes, and if the new size of the
collection is smaller than the index, the index is changed to the new size of the collection
Otherwise, when the index was pointing to one of the deleted nodes, and if the new size of the
collection is equal to or greater than the index, the index is not changed
To re-initialize a repeat index means to change its value to be equal to
The change of index on a
The XForms action system's deferred update flags for rebuild, recalculate, revalidate and refresh are set.
The xforms-delete
event with appropriate context information.
This action affects
In this example, the
The form author could have written nodeset="/purchaseOrder/item"
in
the
In this example, when the shopping-cart
instance are deleted.
This action marks a specific item as current in a repeating sequence (within
Common Attributes:
Special Attributes:
Required reference to a repeating element.
Required XPath expression that evaluates to a 1-based offset into the sequence.
The evaluation context is determined in the same manner as
the evaluation context for a Single-Node Binding
(see
If the selected index is 0 or less, an xforms-scroll-first
event is dispatched and the index is set to 1. If the selected index is greater than the index of the last repeat item, an xforms-scroll-last
event is dispatched and the index is set to that of the last item. If the index evaluates to NaN the action has no effect. The indexes for inner nested repeat collections are re-initialized to
The IDREF from the
The markup contained within the body of element
The Node Set Binding is evaluated to locate the
The
User interface as specified by the
The processing model for repeating structures uses an insert
and delete
operations. Notice that the contained XForms form controls inside element
The binding expression attached to the repeating sequence returns a node-set of the collection being populated, not an individual node. Within the body of element
The form controls appearing inside
It is possible to nest repeat elements to create more powerful user interface for editing structured data. insert
statement that appears as part of that example.
The above insert
statement is used in that example to add new bookmark entries into the 1
. Hence, after a new empty section of bookmarks is created and becomes
Element
Notice that the markup encapsulated by element IDREF
attributes must be interpreted based on a combination of repeat indexes and where the IDREF attributes appear relative to the element bearing the matching ID. Based on the IDREF resolution rules given in
If the focus is transferred to a control within a