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

Question about dependency model and referents node in XPath Expression

From: Sébastien CRAMATTE <contact@zeninteractif.com>
Date: Sat, 06 Jan 2007 16:59:58 +0100
Message-ID: <459FC77E.8090208@zeninteractif.com>
To: www-forms@w3.org

Hello,

I've got a question about  dependency model and referents node in XPath
Expression ...
Considering  this XForms ...

<html>
<head>
<xf:model>
<xf:instance>
<root xmlns="">
    <class enable="true">
        <rate>10</rate>
    </class>
    <class enable="false">
        <rate>15</rate>
    </class>
    <class enable="true">
        <rate>20</rate>
    </class>
</root>
</xf:instance>
<xf:bind nodeset="//class/@enable" type="xsd:boolean" />
</xf:model>
</head>
<body>

<xf:output value="sum(//class[@enable='true']/rate)" />

<xf:repeat nodeset="class">
    <fieldset>
    <legend>class</legend>
    <xf:input ref="@enable">
       <xf:label>Enable</xf:label>
    </xf:input>
    <xf:input ref="rate">
       <xf:label>Rate</xf:label>
    </xf:input>
    </fieldset>
</xf:repeat>

</body>
</html>

As you can see using the repeat module I can display three class rate
value with a checkbox (type xsd:boolean) button to enable/disable each.
Considering this XPath output element :

<xf:output value="sum(//class[@enable='true']/rate)" />

When My XForms processor evaluate  the expression and find "referents"
nodes bellow, only "rate" node with predicate @enable='true' are added
to dependency model during initial
"rebuild+recalculate+revalidate+refresh" sequence

Now, if I change @enable attribute value of the 2nd class node to 'true'
(intialiy @enable='false') and If i change the "rate" value the  "sum" 
output will not be recomputed.
I must check / uncheck  the enable button to refresh it ...

My question is : does my XPath engine should ignore [@enable='true]
predicate and append all  "rate" childs  nodes as referents  ?
When I force this behavior in my XPath lib the "sum"  is recomputed
correctly when I change any rate value.


Thanks for you help

Regards
Received on Saturday, 6 January 2007 16:00:19 GMT

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