Re: Variables in XForms

Nick and all,

I think it is fine for now to define variables within actions and controls.
If I find the time to make a proposal for variables in the model I will.

There are a few points to clarify:

1. Whether variables can appear *within* core form controls (that is,
non-container controls).

Such variables could be used by xforms:label, xforms:itemset, etc. You
could even go further and allow placement within xforms:choices,
xforms:item, etc.

Orbeon does not support this at the moment. For me, it would be ok to say
that variables can be placed wherever a core form control can be placed,
even though there is nothing that would argue against placing variables
within core controls.

2. Whether a variable can omit the @value attribute and be initialized with
constant text content.

Orbeon supports this. You can write:

  <xforms:var name="foo">bar</xforms:var>

and the value takes the value of the string 'bar'. This is consistent with
XSLT and with other XForms constructs like xforms:label.

You could go further and support nested xforms:output, although I don't see
the need for this.

3. Whether, like most controls, a variable supports a binding.

Orbeon supports this. You can write:

  <xforms:var model="my-model" context="instance('bar')" ref="baz"

The @value attribute evaluates relative to the binding, if any.

The binding doesn't use bound MIPs (in particular relevance), but as
suggested the use of @model is convenient, and @context as well. This makes
attributes on the variable consistent with other controls. An
implementation can use the same code for variables and other controls
instead of special-casing variables.

4. Whether variables can be used from control bindings.

For example:

  <xforms:var name="foo" value="bar"/>
  <xforms:input ref="$foo">...

Orbeon supports this, as it's obviously useful. But it might be good to
explicitly say this in the spec.


On Fri, Dec 2, 2011 at 4:21 AM, Nick Van den Bleeken <> wrote:

>  I made a proposal for supporting variables in XForms
>  The proposal just adds variables as child of action and everywhere else
> in the document except in the model. I know that there are use cases for
> defining variables in the model (either explicitly or implicitly by
> defining binds), but scoping and update/dependency rules will become
> probably quite complicated. I see variables defined in the model as global
> variables and so my proposal only defines local variables.
>  A lot of use cases are solved by only supporting local variables, that's
> why I want to propose to only standardize those for now.
> Kind regards,
> Nick Van den Bleeken
> R&D Manager
> Phone: +32 3 821 01 70
> Office fax: +32 3 821 01 71
> ------------------------------
> Inventive Designers' Email Disclaimer:

Received on Wednesday, 14 December 2011 09:13:43 UTC