W3C home > Mailing lists > Public > www-forms@w3.org > February 2007

Re: Why no variables?

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 07 Feb 2007 18:05:51 +0100
Message-ID: <45CA06EF.9040100@orbeon.com>
To: www-forms@w3.org

David, John:

I wholeheartedly agree that variables would be very useful, and that 
David's extension is very valuable. They would be simply as useful in 
XForms as they are in XSLT. I can't count the number of times where I 
have been wanting to use variables, and we have been on the verge of 
implementing David's proposal for a long time!

I believe that the working group agrees that something like this would 
be useful. It won't make it into XForms 1.1 however, so until work on 
XForms 1.2 starts you will have to work around the issue, or use 
extensions provided by your vendor.

-Erik

David Landwehr wrote:
> 
> I wrote up an extension for variable on exforms.org 
> (http://exforms.org/variable.html). It is a *very* good idea to use 
> variables as it is easy to author and can also speed up XPath evaluation 
> when there are many expressions.
> 
> Best regards,
> David
> 
> 
> Clark, John skrev:
>> As I've been working with XForms (primarily 1.1), I've been wondering
>> why the spec doesn't allow for variables.  In particular, I would think
>> that variables would be useful in event handlers (actions), and I think
>> they'd be pretty straightforward to define.  I imagine them looking
>> something like this (where the `xf` prefix maps to the XForms namespace
>> and the `ev` prefix maps to the XML Events namespace):
>>
>>   <xf:action ev:event="some-event">
>>     <xf:variable name="actionContext" value="current()"/>
>>     <xf:variable name="target" value="xpath/to/target"/>
>>     <xf:insert origin="$actionContext/new" context="$target"/>
>>     <xf:delete nodeset="$target/old"/>
>>   </xf:action>
>>
>> At the very least, then, variables would be scoped to the containing
>> action handler; we could then have some interesting discussion about
>> whether or not we'd want to expand that scope to the outermost action
>> handler or even to a global scope.
>>
>> Take care,
>>
>>     John L. Clark  |  Systems Analyst
>>                    |  Cardio-Thoracic Surgery Research
>>  Cleveland Clinic  |  9500 Euclid Ave.   |  Cleveland, OH 44195
>>                    |  (216) 445-6011
>>
>> ===================================

-- 
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/
Received on Wednesday, 7 February 2007 17:06:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:08 GMT