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

Re: Why no variables?

From: David Landwehr <david.landwehr@picoforms.com>
Date: Wed, 07 Feb 2007 16:47:11 +0100
Message-ID: <45C9F47F.9070609@picoforms.com>
To: "Clark, John" <CLARKJ2@ccf.org>
CC: www-forms@w3.org

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,

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
> ===================================
> Cleveland Clinic is ranked one of the top 3 hospitals in
> America by U.S.News & World Report. Visit us online at
> http://www.clevelandclinic.org for a complete listing of
> our services, staff and locations.
> Confidentiality Note:  This message is intended for use
> only by the individual or entity to which it is addressed
> and may contain information that is privileged,
> confidential, and exempt from disclosure under applicable
> law.  If the reader of this message is not the intended
> recipient or the employee or agent responsible for
> delivering the message to the intended recipient, you are
> hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If
> you have received this communication in error,  please
> contact the sender immediately and destroy the material in
> its entirety, whether electronic or hard copy.  Thank you.
Received on Wednesday, 7 February 2007 15:47:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:55 UTC