Can a Bound node-set be Derived from Another Bound Node-Set?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can a Bound node-set be Derived from Another Bound Node-Set?

Spenser Kao

Hi,

 

Just as I try to test through the relevant model instances attached below, a node-set selected-index under instance status, which is bound to the index value of a clicked row of a table populated by

xforms:repeat, has been calculated as anticipated without a glitch.

 

But the other node-set, selected-app-id, which I tried to derive from the value of selected-index, simply can never be calculated.

Just to see if selected-app-id would ever get changed, I even tried different calculation formulas, such as =”instance('app-ids-instance')/*/Application_ID[selected-index]/ID”, or as simple(silly) as calculate==”selected-index +1”, but they changed nothing.

 

So, the question is: can a node-set be indirectly derived from another node-set’s value?

I wonder this is purely a vendor implementation issue? If that’s the case, how has OPS handled this issue?

 

Regards,

 

Spenser

 

**** Start of Test Code ****

<html>

<head>

<xforms:model>

            <xforms:instance id="app-ids-instance">

                        <Application_IDs>

                                    <Application_ID>A1234</Application_ID>

                                    <Application_ID>B5678</Application_ID>

                                    <Application_ID>C9012</Application_ID>                                                           

                        </Application_IDs>

            </xforms:instance>

            <xforms:instance id="status">

                        <status xmlns="">

                                    <action/>

                                    <selected-index/>

                                    <selected-app-id/>

                        </status>

            </xforms:instance>

                        ...

            <xforms:bind nodeset="instance('status')">

                        <!-- A true to attribute required means it can't be empty! -->

                        <xforms:bind nodeset="selected-index" calculate="index('app-id-repeat')" constraint=". >= 1" required="true()"/>

                        <xforms:recalculate/>

                        <xforms:bind nodeset="selected-app-id" calculate="instance('app-ids-instance')/*/Application_ID[instance('status')/*/selected-index]/ID"/>

            </xforms:bind>

</xforms:model>

</head>

<body>

<xforms:repeat nodeset="//Application_ID" id="app-id-repeat">

… <!—Table rows population done here à

</xforms:repeat>

</body>

</html>

**** End of Test Code ****

 

Regards,

 

Spenser Kao

Lending Technology Services Pty Ltd
117 Ferrars Street
South
Melbourne
VIC 3205

Ph: +61 3 8699 7900

Fax: +61 3 9682 8753

Email: [hidden email]

Web: www.lendtech.com.au

 

This email (including all attachments) may contain personal information and is intended solely for the named addressee(s). It is confidential and may be subject to legal or other professional privilege. Any confidentiality or privilege is not waived or lost because this email has been sent to you by mistake. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies.

 

This email is also subject to copyright. No part of it should be reproduced, adapted or communicated without the written consent of the copyright owner. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth).

 

Emails may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems. We give no warranties in relation to these matters. If you have any doubts about the authenticity of an email purportedly sent by us, please contact us immediately.

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Can a Bound node-set be Derived from Another Bound Node-Set?

Erik Bruchez
Administrator
Spenser,

 > Just as I try to test through the relevant model instances attached
 > below, a node-set *selected-index* under instance status, which is
 > bound to the index value of a clicked row of a table populated by
 > xforms:repeat, has been calculated as anticipated without a glitch.
 >
 > But the other node-set, *selected-app-id*, which I tried to derive
 > from the value of *selected-index*, simply can never be calculated.
 >
 > Just to see if *selected-app-id* would ever get changed, I even
 > tried different calculation formulas, such as
 > ="instance('app-ids-instance')/*/Application_ID[selected-index]/ID",
 > or as simple(silly) as calculate=="selected-index +1", but they
 > changed nothing.
 >
 > So, the question is: can a node-set be indirectly derived from another
 > node-set's value?

Yes.

 > I wonder this is purely a vendor implementation issue? If that's the
 > case, how has OPS handled this issue?

In theory, XForms implementations must implement a full-fledged
dependency mechanism between MIPs. OPS doesn't implement that yet, it
just follows document order for the recalculations.

Based on this, your binds are in the right order, so things should
work. However, I notice an error in your code. You write:

   instance('app-ids-instance')/*/Application_ID[...]

Since instance('app-ids-instance') points to the root element
Application_IDs, instance('app-ids-instance')/* points to a node-set
containing all the children Application_ID elements. Since no
Application_ID element has another Application_ID child, your
expression above always return an empty node-set. Write instead:

   instance('app-ids-instance')/Application_ID[...]

(Note that <xforms:recalculate/> will not do anything where you put it!)

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Can a Bound node-set be Derived from Another Bound Node-Set?

Spenser Kao
Hi Erik,

>In theory, XForms implementations must implement a full-fledged
>dependency mechanism between MIPs. OPS doesn't implement that yet, it
>just follows document order for the recalculations.
>Based on this, your binds are in the right order, so things should
>work.

Yes, the derivation from the first binds to the second will work if
xxforms:evaluat() is used, otherwise the first bind wont get evaluated
timely, and the second one wont either. Here is how I put them together:

<xforms:bind nodeset="selected-app-id"
calculate="instance('app-ids-instance')//Application_ID[xxforms:evaluate(ins
tance('status')/selected-index)]/ID"/>


>However, I notice an error in your code. You write:
>   instance('app-ids-instance')/*/Application_ID[...]

You're right, I'd already corrected by
instance('app-ids-instance')//Application_ID, which means to get the
whatever first element namely Application_ID through as many as layers,
while /Application explicitly expects the first layer child element with
that name under root.

Regards,
 
Spenser Kao






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws