Re: Sugestion for a bind(IDREF) XPath function

Hello Peter,

Sunday, April 15, 2007, 6:34:37 AM, you wrote:

>  One issue I frequently come up against is the verbosity of the xpath functions in the setvalue expression.
>  I have prototyped and implemented an xforms extension function called bind(IDREF) that considerably reduces the amount of xpath code that needs to be entered.
>  The suggested function has the following form:
>  
>  node-set bind(idref)
>  
>  The function returns a nodeset that is the product of the evaluaion of a bind whose id is idref. If the node-set
> referenced by the id-ref contains a reference to an xpath containing a circular reference then an xforms-binding-error event should be raised.
It is indeed a useful function, since we already have in instance() function, bind() is a logical next step,
and context() function may kill a lot of pain.

[Peter]
I would propose that a solution to the issue is to have a new function called context() which returns the bound context
of an xforms node. There are lots of issues, particularly with nested repeats, but with the re-write I did in MozzIE it
would be quite easy to implement.
[/Peter]

Se we can write:
><xforms:repeat bind="bindColor" id="rptColors">
>  <xforms:trigger>
>    <xforms:label>Select Color</xforms:label>
>    <xforms:setvalue bind="bindSelectedColor"
>                    value="context()/node()"
>                 ev:event="DOMActivate" />
>  </xforms:trigger>
></xforms:repeat>

Or even:
><xforms:repeat bind="bindColor" id="rptColors">
>  <xforms:repeat bind="shades" id="rptColorsShades">
>    <xforms:trigger>
>      <xforms:label>Select Color</xforms:label>
>      <xforms:setvalue bind="bindSelectedColor"
>                      value="context(rptColors)/node()"
>                   ev:event="DOMActivate" />
>    </xforms:trigger>
>  </xforms:repeat>
></xforms:repeat>

P.S. I am more in favor of context() function than context attribute.

-- 
Best regards,
 Ivan                            mailto:IvanLatysh@yahoo.ca

Received on Sunday, 15 April 2007 18:02:14 UTC