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

RE: FW: Evaluating the relevant property expression when the bound instance node doesn't exist...

From: Fennell, Philip <philip.fennell@hp.com>
Date: Tue, 13 Feb 2007 09:10:14 -0000
Message-ID: <C4B3FB61F7970A4391A5C10BAA1C3F0D6EC096@sdcexc04.emea.cpqcorp.net>
To: <www-forms@w3.org>


> That does not follow: you can add attributes with xforms:insert.

Oh, that's something that hadn't occurred to me, thank you :-)

There's a lot in your response that I need to look at and think about.
Your help is much appreciated.


Philip Fennell

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Erik Bruchez
Sent: 12 February 2007 22:38
To: www-forms@w3.org
Subject: Re: FW: Evaluating the relevant property expression when the
bound instance node doesn't exist...


 >> Now there is a twist: a control bound to a non-existing node is  >>
considered non-relevant.
 > If a control is non-relevant because it is bound to a non-existent  >
node, surely that would imply that the control should be rendered  >

That's right, and that's what the spec mandates (and has in fact been
made clearer in either an errata to 1.0 or in 1.1, I am not sure).

 > and therefore it would be impossible, for example, to add attributes
> to a node that had not had those attributes already declared!

That does not follow: you can add attributes with xforms:insert.

I can imagine how you could have controls able to create nodes on their
own, but XForms doesn't have this particular feature (if you except the
lazy authoring feature that allows controls to create nodes during
initialization if you don't specify an instance at all).

 > In essence, I want to create a dependency between two attributes  >
such that it doesn't make sense to have the later without the  > former.
However, if both attributes are implied then how can you  > test the
dependency, as expressed with the relevance MIP, if:
 > a) The context for the test is the later and,  > b) the later doesn't
 > I've reworked my example with some of your corrections:
 > <xforms:model>
 > 	<xforms:instance xmlns="">
 > 		<area x="0" y="0"/>
 > 	</xforms:instance>
 > 	<xforms:bind id="area.width" nodeset="@width"
 > relevant="../@height"/>
 > </xforms:model>
 > <xforms:input bind="area.width">
 > 	...
 > </xforms:input>
 > 1) I must be able to input a value for @width regardless of whether
> it has already been specified in the instance data.

This mandates that there is, somewhere, a node to which the input
control can be bound. One way to do this, graphically, is to use two

1. xforms:input bound to @width, which may or may not exist. If it
    does not exist, the control doesn't show.

2. xforms:trigger, visible only if the node does not exist. When the
    user activates the trigger, the node is created, and the
    xforms:input automatically appears. Because it is now bound to a
    node, you can enter data in it. You may want to add another trigger
    to remove the attribute (or change the behavior of the trigger to
    add the node if it doesn't exist, and delete it if it does exist.)

<xforms:input bind="area.width">...</xforms:input>
<xforms:trigger ref=".[not(@width)]">
   <xforms:insert context="." origin="instance('template')/@width"/>
<xforms:trigger ref=".[@width]">
   <xforms:delete context="." nodeset="@width"/> </xforms:trigger>

(Note that xforms:insert and xforms:dlete above use XForms 1.1

 > 2) If I want to have the ability to prevent the input a values for  >
@width if @height has not already been defined then the relevance  >
expression is meaningless without a valid context (in this case  >

If think your binding expression will work fine for xforms:input with
the above: it will make the control bound to @width non-relevant if
there is no height. But then you also need to control the appearance of
the Add/Remove triggers. You could maybe write:

<xforms:trigger ref=".[@height and not(@width)]">
   <xforms:insert context="." origin="instance('template')/@width"/>
<xforms:trigger ref=".[@height and @width]">
   <xforms:delete context="." nodeset="@width"/> </xforms:trigger>

 > If, as I believe this problem cannot be solved as it is expressed
then  > can I express the binding and the relevance test in another way
so that  > the absence of a valid context node is not an issue?

 > xforms:bind id="area.width" nodeset="area" calculate="@width"
 > relevant="@height"/>

@calculate already returns a string value, so it cannot be used to
create attributes or elements, if that's what you wanted to do here.


Orbeon Forms - Web Forms for the Enterprise Done the Right Way
Received on Tuesday, 13 February 2007 09:10:35 UTC

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