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

Hello,

I believe I'm correct when I say that a relevant expression is evaluated
relative to the target nodeset of a bind instruction. If so then, where
an xforms:bind targets an attribute node e.g.


<xforms:instance xmlns="">
	<area x="0" y="0"/>
</xforms:instance>

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


and the binding is only relevant if some other attribute exists, then if
@width was absent, how could I test the relevancy of the 'area.width'
binding?

Would this example binding always be 'non-relevant' when the @width is
missing?
If so does this imply that the form/data design is incorrect and the
problem has to be resolved by a change to the schema and form?




Regards

Philip Fennell





 

-----Original Message-----
From: Fennell, Philip 
Sent: 09 February 2007 11:11
To: www-forms@w3.org
Subject: RE: Multiple xforms:instance elements vs. relevant="false()"

John,
 
Thank you for your reply, you've given me some food for thought.


Regards

Philip Fennell 
 


________________________________

From: John Boyer [mailto:boyerj@ca.ibm.com]
Sent: 08 February 2007 17:12
To: Fennell, Philip
Cc: www-forms@w3.org; www-forms-request@w3.org
Subject: Re: Multiple xforms:instance elements vs. relevant="false()"



Hi Philip, 

Maybe because I'm reading too fast, but it's not altogether clear what
you're doing.  If the answer below doesn't work for you, then maybe you
could post a short example in markup that models the problem you have
with a minimum of data. 

I don't understand why you need two separate instances.  You have some
data that you are allowed to edit with some controls.  You also want to
"view" the results of changes.  But in that case you just bind more
"output" controls to the same data nodes.  You can attach as many
controls as you like to the same data node.  You can even attach
multiple input controls to the same node.  Any time you modify a node
using a particular input control, the result is reflected in all the
other controls because they are bound to the same node. 

If you have two instances, then how do you plan to keep the "source"
instance and the "view" instance synchronized.  I don't think this is
very easy (because this isn't the type of thing you'd do in XForms due
to the ability to attach multiple view controls to the same data node). 

However, suppose for some reason you do have two instances.  Maybe not
the same reason you have right now.  In that case, it sounds like you
want to submit only one instance and not any other instances.  But this
is already what a submission does.  A submission allows you to send one
instance of data (or a part of that instance).  Therefore you don't need
any relevance binds to force the other instances to be excluded from a
submission. The act of putting data into a separate instance is enough.
By doing so, you are saying that the data in that separate instance is
created for some separate purpose not related to the first instance. 

This is a significant power advantage over older HTML forms, which
aren't really designed to allow you to have two distinct thoughts in
your head at the same time. 

Anyway, as a final thought, I note that you want to make your "view" be
readonly.  Maybe you are thinking that you need two instances of data
because you want to make one instance readonly with a bind and have the
other instance (the source) be modifiable.  But if you use the xforms
output control for your view only controls, then they are inherently
readonly and you can stick with only one data instance (the modifiable
one).  Since you don't want the view only controls to take input into
the instance, you shouldn't use input controls.  By using output
controls, you are communicating that you want only to render the data. 

Cheers, 
John M. Boyer, Ph.D.
STSM: Workplace Forms Architect and Researcher
Co-Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com  http://www.ibm.com/software/

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer





"Fennell, Philip" <philip.fennell@hp.com> 
Sent by: www-forms-request@w3.org 

02/07/2007 04:51 AM 

	
To
	<www-forms@w3.org> 
cc
	
Subject
	Multiple xforms:instance elements vs. relevant="false()"

	





Hello,

I have a scenario where there is a source document (model) and a
rendering (view). I generate an XForm that allows me to both edit the
values of attributes in the source document and see values of attributes
generated in the view. For example, I may define an object in the source
but it has properties that are computed by the viewer.

Notes: 

a) Source and view properties are mutually exclusive.
b) View properties are regarded as read-only.


In these types of situation I see two possible options:



1) Multiple instances.
----------------------

Create a 'model' xforms:instance and a 'view' xforms:instance in the
same xforms:model. The xforms:bind elements reference the two instances
using the instance(xs:IDREF) function. I believe I'm right in assuming
that I would use the instance() function on the xforms:submission
element's ref attribute to indicate which instance to use (unless the
'model' instance is the first within the xforms:model and therefore the
default instance for submission).



2) relevant = "false()"
-----------------------

Merge the view properties with those of the source element (see note 'a'
above) in a single xforms:instance and then upon their respective
bindings set the 'view' properties to relevant="false()". In this case,
when the form is submitted, I believe the irrelevant nodes will be
removed from the instance that is submitted. All bindings will point to
the same xforms:instance.


Please could I have some 'best practice' guidance as to which option
would be considered more practical/preferable?


Regards

Philip Fennell

Received on Monday, 12 February 2007 12:59:07 UTC