AVTs

From W3C XForms Group Wiki (Public)
Jump to: navigation, search


Concept

We have been discussing the Attribute Value Template (AVT) forever in various calls and f2f. This is an extremely convenient feature for form authors, and it solves, in an elegant way, the question of how to make attribute values dynamic. Several XForms implementers have experience with this.

Optionally, AVTs could be supported on host language attributes. If this were the case, the AVTs would be useful in solving an important class of problem regarding presentation. An example taken from the Orbeon wiki, shown below, illustrates how AVTs can be used to generate simple odd/even styling within repeated table rows:

<xhtml:table class="zebra-table">
  <xhtml:tbody>
    <xforms:repeat nodeset="*">
      <xhtml:tr class="row-{if (position() mod 2 = 0) then 'even' else 'odd'}">
        <xhtml:td>
          <xforms:output value="."/>
        </xhtml:td>
      </xhtml:tr>
    </xforms:repeat>
  </xhtml:tbody>
</xhtml:table>

In the above example a simple XPath 2.0 expression is evaluated that generates one of two strings, 'even' or 'odd', depending on the position of the context node.

More complex cases can also be handled where indications of state, that go beyond a conventional Model Item Property (MIP), are expressed in relation to the instance data or calculated from it.

AVTs are implemented by Orbeon http://wiki.orbeon.com/forms/doc/developer-guide/xforms-attribute-value-templates

Proposal (Editorial meeting 2011-12)

Add AVT support to all attributes (XForms and optionally host language) that don't contain an XPath expression.

We should probably add an exception for the following attributes:

  • ID attributes
  • model attributes : version, functions, schema
  • bind attributes: type , p3ptype
  • instance attributes: src and resource
  • controls: inputmode, incremental and appearance

Note:

We should also consider what we are going to do with the dynamic child elements for attributes on the parent element. We could either leave them, deprecate them or remove them.

Implementations

Status

Awaiting proposal from Erik Bruchez.