W3C

The Bind Module

W3C First Public Working Draft 01 January 2009

This version:
http://www.w3.org/TR/2009/WD-actions-20090501/
Latest version:
http://www.w3.org/TR/actions/
Previous version:
http://www.w3.org/TR/2007/CR-actions-20071129/

Editor:
Nick Van den Bleeken, Inventive Designers

This document is also available in these non-normative formats: diff-marked HTML .

The English version of this specification is the only normative version. Non-normative translations may also be available.


Abstract

The bind module defined in this specification provides XML languages with the ability to assign an identifier (xsd:ID) and infoset contributions (Model Item Properties) to instance data nodes. This specification only provides a uniform way for assigning Model Item Properties to instance data nodes, other modules will define those Model Item Properties.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is a Working Draft of the W3C. This document has been produced by the W3C Forms Working Group as part of the Forms Activity within the W3C Interaction Domain. The authors of this document are the W3C Forms Working Group participants.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

Comments on this document are welcome. Please send discussion comments to www-forms@w3.org. Please send formal comment about this document to the public editor mailing list www-forms-editor@w3.org. (archive).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. The Working Group maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1 Introduction
2 The bind module
    2.1 The bind Element
    2.2 The bind attribute
    2.3 The mip Element
    2.4 Model Item Properties Attribute Collection
    2.5 Evaluation Context
    2.6 Rebuild action
    2.7 Error Indications
        2.7.1 The xforms-binding-exception Event
        2.7.2 The xforms-idref-exception Event
3 Glossary Of Terms

Appendices

A References
    A.1 Normative References
B Acknowledgements (Non-Normative)
C Production Notes (Non-Normative)


1 Introduction

This document describes the Bind Module, which includes a collection of elements and attribute groups that provides XML languages with the ability to uniformly assign identifiers (xsd:ID) and Model Item Properties (MIP) to instance data nodes. The different Model Item Properties aren't specified in this module but are added by other modules that will extend the Model Item Properties attribute group.

This document uses the terms must , must not , required , shall , shall not , recommended , should , should not , may , and optional in accord with [RFC 2119] .

2 The bind module

This module defines the bind element.

ElementAttributesMinimal Content Model
bindCommon, Node-Set Binding, Model Item Properties(bind | mip)*
mipname, value, type, cascadePCDATA

Additionally this module introduces/extends the following Attribute collections:

Collection NameAttributes in Collection
Model Item Properties
Node-Set Binding&bind
Single-Node Binding&bind

2.1 The bind Element

The bind element uses a node-Set Binding to assign Model Item Properties to the selected instance data nodes. If the bind element has an attribute of type xsd:ID, then it also associates the specified identifier with the instance data nodes the bind selects.

Common Attributes: Common , Node-Set Binding, Model Item Properties

Editorial note: Nick Van den Bleeken2008-12-12
Be sure that the model element restricts the instance element to instances in the current model, and the model attribute to the current model.

2.2 The bind attribute

The bind attribute is added to the Node-Set Binding and Single-Node Binding attributes set. The bind attribute will contain an IDREF to a bind element, which will provide the node-set for the binding. For a Single-Node Binding the first node rule is applied.

When a bind attribute is encountered on a bind element the bind element and all it's descendant binds are ignored.

Editorial note: Nick Van den Bleeken2008-07-22
Where do we define the the resolving of ID References in XForms?

It is an exception (xforms-idref-exception) if the XForms Processor encounters a bind attribute IDREF value that refers to an ID that is not on a bind element.

2.3 The mip Element

The mip element adds support for attaching custom Model Item Properties to data nodes.

Special Attributes:

name

Required. Name of the Model Item Property.

value

Optional. An XPath expression to be evaluated. The result should be convertible to to the type specified by the type attribute.

The conversion is done using the XPath functions string(), boolean() and number() for the types xs:string, xs:boolean and xs:number respectively.

type

Optional The type of the value of the Model Item Property. The type attribute supports values xs:string, xs:boolean and xs:number. The default value is "xs:string".

cascade

Optional If the cascade property is "true" the Model Item Property will also be applied to all the descendants of the data node to which this Model Item Property applies. The default value is "false".

combine-cascade

Optional An XPath expression that specifies how the local and cascaded value of a Model Item Property should be combined. The result should be convertible to to the type specified by the type attribute. The default value is "error('xforms-binding-exception')".

The local and cascaded value are made available to the XPath expression through XPath variables $local-value and $cascaded-value respectively.

Example of a custom mip
<bind nodeset="//total">
  <mip name="readonly" value="true()" type="xs:boolean" cascade="true" combine-cascade="$local-value or $cascaded-value"/>
</ bind>

Here we attached the Model Item Property with name readonly and a boolean value of true to all the nodes with name total and their descendants.

2.4 Model Item Properties Attribute Collection

Model item properties are infoset contributions made to instance data nodes and can be distinguished along various axes.

Computed expressions vs. fixed properties:

  • Fixed properties are static values that the XForms Processor evaluates only once. Such properties consist of literals, and are not subject to XPath evaluation.

  • Computed expressions are XPath expressions that provide a value to the XForms Processor. Such values are recalculated at certain times as specified by the model which they are defined. These expressions encode dynamic properties, often constraints, such as the dependency among various data items. Computed expressions are not restricted to examining the value of the instance data node to which they apply. XPath expressions provide the means to traverse the instance data; more complex computations may be encoded as call-outs to external scripts.

Inheritance rules:

Some model item properties define inheritance rules, in which case the XForms Processor needs to keep track of two separate values: 1) the local value, which is applied from an attribute of element bind, and 2) the inherited value, which is determined by combining the evaluated local value with the evaluated values from ancestor nodes in the instance data.

Editorial note: Nick Van den Bleeken2008-07-17
Removed : "The sample recalculation algorithm defined in (specref to recalc) is defined to operate only on the local values of a model item property. It assumes that an implementation propagates the combined values to a node's descendants."

Assigning local values:

Local values are assigned by processing all bind elements in an XForms Model in document order. It is an error to attempt to set the same model item property twice on the same node.

2.5 Evaluation Context

The evaluation context of a Model Item Property expression of a bind element is the in-scope evaluation context. But the Model Item Properties are attaches to the nodes of a nodeset binding if the bind element specifies a nodeset binding, and otherwise the bind element attaches the Model Item Properties to the initial in-scope evaluation context.

2.6 Rebuild action

2.7 Error Indications

Error indications happen as a result of unusual conditions in the XForms Processor. This module contains only "fatal" errors, which halt processing, and bear the suffix "exception". For all events in this section, it is permissible for the XForms Processor to perform some kind of default handling, for example logging error messages to a file.

2.7.1 The xforms-binding-exception Event

Dispatched as an indication of an illegal binding expression.

Target: any element that can contain a binding expression

Bubbles: Yes

Cancelable: No

Context Info: None

Default Action: Fatal error (halts processing).

2.7.2 The xforms-idref-exception Event

Dispatched as an indication of an id reference resolution that fails. The ID reference resolution can fail due to the following two reasons:

  1. No element with the referenced ID is present in the document.

  2. The element with the referenced ID is not of the expected type (e.g.: a bind attribute with an IDREF value that refers to an ID that is not on a bind element).

Target: any element that can contain a binding expression

Bubbles: Yes

Cancelable: No

Context Info:

PropertyTypeValue
error-typestringOne of the following: id-not-found, invalid-element-type.

Default Action: Fatal error (halts processing).

Editorial note: Nick Van den Bleeken2008-10-15
I'm not sure if we need to define this event in this module, because the modules model and submission can be used without the bind module.

3 Glossary Of Terms

Computed expression

[Definition: An [XPath 1.0] expression used by model item properties such as relevant and calculate to include dynamic functionality in XForms.]

Model Item Property

[Definition: An infoset contribution to an instance data node. ]

Node-Set Binding

[Definition: A node-set binding is a binding that is capable of associating any number of XML data nodes with the object that bears the node-set binding attribute. Modules of the consuming profile define the semantics of the association. For example, an object may simply use the multiplicity of nodes in a behavioral operation, or the object may generate a multiplicity of related objects and implicitly bind each related object with one of the XML data nodes located by the node-set binding.]

XForms Processor

[Definition: A software application or program that implements and conforms to the XForms specification.]

A References

A.1 Normative References

RFC 2119
RFC 2119: Key words for use in RFCs to Indicate Requirement Levels, S. Bradner, 1997. Available at http://www.ietf.org/rfc/rfc2119.txt.
XPath 1.0
XML Path Language (XPath) Version 1.0, James Clark, Steve DeRose, 1999. W3C Recommendation available at: http://www.w3.org/TR/1999/REC-xpath-19991116.

B Acknowledgements (Non-Normative)

This document was produced with the participation of Forms Working Group participants. Current participants include:

C Production Notes (Non-Normative)

This document was encoded in the XMLspec DTD v2.6. The XML sources were transformed using diffspec and xmlspec stylesheets, version 2.6. The XML Schema portion of the Appendix was rendered into HTML with the xmlverbatim XSLT stylesheet (used with permission). The primary tool used for editing was XMLSpy. The XML was transformed using the XSLT processor in Java 6. The editor(s) use the W3C CVS repository and the W3C IRC server for collaborative authoring.