eXforms - extending XForms 1.0

14 December 2006

This version:
http://exforms.org/mips.html
Editor:
David Landwehr, exforms.org

Status of this Document

This modules defines a set of [XPath 1.0] functions to access the model item property states of a node in a instance. The following is the model item properties from the [XForms 1.0] that can be accessed:

Table of Contents

1 Model Item Properties Extension
    1.1 The Module
    1.2 The exf:relevant() Function
    1.3 The exf:readonly() Function
    1.4 The exf:required() Function
2 References
    2.1 Normative References

Appendix

A Acknowledgments (Non-Normative)


1 Model Item Properties Extension

1.1 The Module

This modules defines a set of [XPath 1.0] functions to access the model item property states of a node in a instance. The following is the model item properties from the [XForms 1.0] that can be accessed:

readonly true if the node or one of its anscestors has a readonly model item property which computes to true.
relevant false if the node or one of its anscestors has a relevant model item property which computes to false.
required true if the node has required model item property which computes to true.

When a processor implements this extensions it must include the states as dependencies in the master dependency graph when calculating dependent nodes. This means that e.g. a calculate expression must be marked for recalculation when a node has a state change which the expression was dependent on.

It is possible to create circular dependencies using the functions defined in this module. If during the rebuild a circular dependency is detected then processing must termined as defined by the XForms specification.

The module name to be used for is defined as exf:mip.

1.2 The exf:relevant() Function

boolean exf:relevant(node-set?)

The exf:relevant() returns the relevant state of the node from the node-set which is first in document order. If the node-set is empty then the function returns false. If the argument is omitted, it defaults to a node-set with the context node as its only member.

Example: how to use exf:relevant()
<xforms:model>
  <xforms:instance>
    <data xmlns="">
      <node1/>
      <node2/>
    </data>
  </xforms:instance>
  <!-- data1 is relevant if data2 is-->
  <xforms:bind nodeset="data1" relevant="exf:relevant(../data2)"/>

1.3 The exf:readonly() Function

boolean exf:readonly(node-set?)

The exf:readonly() returns the readonly state of the node from the node-set which is first in document order. If the node-set is empty then the function returns false. If the argument is omitted, it defaults to a node-set with the context node as its only member.

Example: how to use exf:readonly()
<xforms:model>
  <xforms:instance>
    <data xmlns="" readonly="false">Data</data>
  </xforms:instance>
  <xforms:bind nodeset="text()" required="not(exf:readonly())" readonly="../@readonly="false"/>

1.4 The exf:required() Function

boolean exf:required(node-set?)

The exf:required() returns the required state of the node from the node-set which is first in document order. If the node-set is empty then the function returns false. If the argument is omitted, it defaults to a node-set with the context node as its only member.

Example: how to use exf:required()
<xforms:model>
  <xforms:instance>
    <data xmlns="" required="false">Data</data>
  </xforms:instance>
  <xforms:bind nodeset="." required="boolean-from-string(@required)"/>
</xforms:model>
...
<xforms:value output="concat('element required is ', exf:required(/data))"/>

2 References

2.1 Normative References

XForms 1.0
XForms - Version 1.0, John M. Boyer, David Landwehr, Roland Merrick, T. V. Raman, Micah Dubinko, Leigh L. Klotz, Jr., 2006. W3C Recommendation available at: http://www.w3.org/TR/xforms/.
XML Events
XML Events - An events syntax for XML, Steven Pemberton, T. V. Raman, Shane P. McCarron, 2002. W3C Recommendation available at: http://www.w3.org/TR/xml-events/.
XPath 1.0
XML Path Language (XPath) Version 1.0, James Clark, Steve DeRose, 1999. W3C Recommendation available at: http://www.w3.org/TR/xpath.
XML Schema part 1
XML Schema Part 1: Structures, Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, 2001. W3C Recommendation available at: http://www.w3.org/TR/xmlschema-1/.
XML Schema part 2
XML Schema Part 2: Datatypes, Paul V. Biron, Ashok Malhotra, 2001. W3C Recommendation available at: http://www.w3.org/TR/xmlschema-2/.
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.

A Acknowledgments (Non-Normative)

eXforms.org would like to thank the following for their contributions in creating the extensions:

  • David Landwehr, exforms.org / SolidApp
  • Kenneth Sklander, picoforms.com
  • Allan Beaufour, beaufour.dk