Re: The xforms-rebuild Event

Steven,

I might be miss understanding you, but I don’t see how process(seq, bindchildren) can work in point 3.

Because we need to iterate over all the binds in the bindchildren list for every node in the sequence.

The evaluation context in which you evaluate the ref has a context item (items in the seq) and a position starting from 1 for the first item in seq.

Let me rewrite your pseudo code to let me show where I think the ‘problem’ is:

xforms-rebuild: process({ contextItem: instance(), contextPosition: 1, contextSize:1}, topBinds)

process(cntx, blist): 
  for bind in binds:
            if bind has ref:
                 seq= eval(cntx, ref);
            else: seq= inscope
            for v in seq:
                 applymips(bind, v);
            if bind has bindchildren:
                for v in seq:  (i: index in list starting from 1, length: length of list
                    process({contextItem: v, contextPosition: i, contextSize: length}, bindchildren)

As you can see the arguments of the process() function are the context and the bind list. The context [1] consists of the context item, context position, context size, Variable values, …

And that is why there is the sentence in point 3 “For each item in the selected sequence of items” is there, if you ask me.

1: https://www.w3.org/TR/xpath20/#context


Regards,

Nick Van den Bleeken
Product Evangelist 
 
Reach.
www.scripturaengage.com <http://www.scripturaengage.com> • www.inventivedesigners.com <http://www.inventivedesigners.com>
Connect. 
+32 3 425 41 02 • (M) +32 499 51 85 02
Engage.
Facebook <http://www.facebook.com/inventivedesigners>  • Twitter <http://www.twitter.com/scriptura> •  LinkedIn <https://www.linkedin.com/company/13166?trk=tyah&trkInfo=idx%3A1-1-1%2CtarId%3A1424938899339%2Ctas%3Ainventive+designers> •  Google+ <https://plus.google.com/+inventivedesigners> • YouTube <https://www.youtube.com/user/InventiveDesigners> •  SlideShare <http://www.slideshare.net/InventiveDesigners/>

 <https://www.scripturaengage.com/event/V8-trainingweek-october2016>


Scriptura Engage is an Inventive Designers solution. The following disclaimer <https://www.inventivedesigners.com/about/legal> applies to this message.

On 15/11/2016, 12:55, "Steven Pemberton" <steven.pemberton@cwi.nl> wrote:

    On Tue, 15 Nov 2016 11:26:49 +0100, Nick Van den Bleeken  
    <Nick.Van.den.Bleeken@inventivegroup.com> wrote:
    
    > Steven,
    >
    > Not sure about you proposed change. In fact the binds of the child binds  
    > need to be processed as described in the three points of this list for  
    > every item (including its position) in the selected sequence of items  
    > for the current processed binding. And this needs of course to be done  
    > recursively for every level of child bind elements.
    
    I suppose I didn't explain my point properly, because I'm not proposing a  
    change, just a better description. Point 2 already evaluates each item in  
    the sequence, so it doesn't need to be done in point 3 as well. If I write  
    it as a function, it might be more obvious:
    
    Now:
    xforms-rebuild(inscope, binds)
        for bind in binds:
            if bind has ref:
                 seq= eval(inscope, ref);
            else: seq= inscope
            for v in seq:
                 applymips(bind, v);
            if bind has bindchildren:
                for v in seq:
                    process({v}, bindchildren}
    
    Proposed:
    xforms-rebuild(inscope, blist)
        for bind in binds:
            if bind has ref:
                seq= eval(inscope, b.ref);
            else: seq= inscope
            for v in seq:
                 applymips(bind, v);
            if bind has bindchildren:
                 process(seq, bindchildren}
    
    Steven
    
    >
    > In the following example the bind nested bind needs to be evaluated for  
    > all the items the outer bind returns by evaluating foo/bar :
    > <xf:bind ref=”foo/bar” …>
    >    <xf:bind ref=”baz” ..>
    >
    > Regards,
    >
    > Nick Van den Bleeken
    > Product Evangelist
    > Reach.
    > www.scripturaengage.com <http://www.scripturaengage.com> •  
    > www.inventivedesigners.com <http://www.inventivedesigners.com>
    > Connect.
    > +32 3 425 41 02 • (M) +32 499 51 85 02
    > Engage.
    > Facebook <http://www.facebook.com/inventivedesigners>  • Twitter  
    > <http://www.twitter.com/scriptura> •  LinkedIn  
    > <https://www.linkedin.com/company/13166?trk=tyah&trkInfo=idx%3A1-1-1%2CtarId%3A1424938899339%2Ctas%3Ainventive+designers>  
    > •  Google+ <https://plus.google.com/+inventivedesigners> • YouTube  
    > <https://www.youtube.com/user/InventiveDesigners> •  SlideShare  
    > <http://www.slideshare.net/InventiveDesigners/>
    >
    >  <https://www.scripturaengage.com/event/V8-trainingweek-october2016>
    >
    >
    > Scriptura Engage is an Inventive Designers solution. The following  
    > disclaimer <https://www.inventivedesigners.com/about/legal> applies to  
    > this message.
    >
    > On 14/11/2016, 14:41, "Steven Pemberton" <steven.pemberton@cwi.nl> wrote:
    >
    >     https://www.w3.org/community/xformsusers/wiki/XForms_2.0#The_xforms-rebuild_Event

    >    When dealing with nested binds:
    >     <bind ref="a" type="integer">
    >       <bind readonly="true()"/>
    >      </bind>
    >    Point 3 says
    >    "For each item in the selected sequence of items, any child bind  
    > elements
    >     are recursively processed as described in the three points of this  
    > list."
    >    Since a bind works on a sequence of items, I think this should really  
    > say
    >     (though it is probably equivalent)
    >     "Any child bind elements are recursively processed as described in  
    > the
    >     three points of this list."
    >    Steven
    

Received on Tuesday, 15 November 2016 13:48:41 UTC