RE: Binding to nodes that do not exist

Mark,

thank you.

It shouldn't but it does, in fact, in my XForms Navigator (Novell, may
be in advance :)

What kind of failure (error/exception ...) should occur, according to
you ?

Regards, vinzo.

Le vendredi 09 septembre 2005 à 11:16 +0100, Mark Birbeck a écrit :

> Vince,
> 
> > <xf:group ref="if(string-length(name(/path/to/the/node)) > 0, /null, .)">
> >  <xf:trigger>
> >       <xf:label>
> >           Add New
> >       </xf:label>
> >  </xf:trigger>
> > </xf:group>
> >
> > where /null is a node that never exists.
> >
> > It´s not very nice but ... it works.
>  
> Unfortunately, it shouldn't work :)
> The if() function takes parameters of strings, and also returns a string. So
> your if() function will straight away fail (or rather, should) since you are
> passing in nodes. However, given that most people assume as you have done
> that it *should* take and return a node, it's obviously an unnecessary
> limitation, and takes nothing to implement in the way you have described. We
> raised exactly this issue a little while ago on the XForms WG, after two of
> us here made exactly the same mistake as you and were annoyed to find that
> it didn't work. The point has been accepted, and the debate is whether to
> make a change to the if() function, or to add a new function that is more
> general.
> 
> One other point is that you don't need the xf:group that you have put in,
> since you can just put the @ref straight onto the xf:trigger.
> 
> So returning to the original question, if we had a customer node that
> contains a list of customers, we could control the xf:trigger like this:
> 
>   <xf:group ref="customers">
>     <xf:repeat nodeset="customer">
>       ...
>     </xf:repeat>
> 
>     <xf:trigger ref=".[not(*)]">
>       <xf:label>Add Item</xf:label>
>     </xf:trigger>
>   </xf:group>
> 
> Rather than trying to manipulate the empty nodeset, we test whether the
> parent has any children. In most cases this should work.
> 
> Regards,
>  
> Mark
> 
> 
> Mark Birbeck
> CEO
> x-port.net Ltd.
> 
> e: Mark.Birbeck@x-port.net
> t: +44 (0) 20 7689 9232
> w: http://www.formsPlayer.com/
> b: http://internet-apps.blogspot.com/
> 
> Download our XForms processor from
> http://www.formsPlayer.com/
> 
> 
> 
> 

-- 
Vincent Berger <vincent.berger@afp.com>
Agence France-Presse

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This e-mail, and any file transmitted with it, is confidential and  intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please  contact the sender and delete the email from your system. If you are  not the named addressee you should not disseminate, distribute or copy  this email.

For more information on Agence France-Presse, please visit our web site at http://www.afp.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Received on Friday, 9 September 2005 13:13:16 UTC