Attribute Value Templates (AVT)

Release 2.0 - ...

Attribute Value Templates are an extension to XSLT that have been integrated into XForms by several vendors and will probably be part of a future XForms specification. AVT allows a form author to query instance data from within an attribute that is defined as static by the XForms sepcification.

Syntax

Within attributes that are marked for AVT (see the list below) values between curly braces are resolved within the evaluation context of the current element. A literal curly brace can be escaped by doubling it: "{{" becomes "{". Here's an example:

XML CopyCode image Copy Code
<xforms:trigger>
 <xforms:label>Load Xforms Spec using AVT</xforms:label>
 <xforms:load ev:event="DOMActivate" resource="http://www.{/data/avt/domain}/TR/{/data/avt/directory}/" />
</xforms:trigger>
<xforms:trigger>
 <xforms:label>Load Xforms Spec using AVT</xforms:label>
 <xforms:load ev:event="DOMActivate" resource="{/data/avt/@uri}" />
</xforms:trigger>

These load actions get their resource from the model below:

XML CopyCode image Copy Code
<xforms:model>
 <xforms:instance xmlns="">
  <data>
   <avt uri="http://www.w3.org/TR/xforms11/">
    <domain>w3.org</domain>
    <directory>xforms11</directory>
   </avt>
  </data>
 </xforms:instance>
</xforms:model>

The Smartsite XForms Engine supports AVT in the following attributes:

  • Submission element
    • method
    • action
    • resource
    • serialization
    • mediatype
    • version
    • encoding
    • separator
    • indent
    • omit-xml-declaration
    • standalone
    • validate
    • relevant
    • mode
  • Dispatch action
    • name
    • target
    • delay
  • Load action
    • resource
    • show
  • Setfocus action
    • control
  • Insert action
    • position
  • Toggle action
    • case
  • All visible elements
    • class (equivalent to the HTML class attribute)
  • All attributes on html elements
    • A specific exception to this rule is the xml:lang attribute. The engine uses this attribute to determine the locale to use when parsing and displaying numbers and dates. This is done before any models are loaded.