You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by oceatoon <t....@systheo.com> on 2004/06/02 16:50:42 UTC

CForms:fb:insert-node???

Hi everyone 

I'm trying to generate a new node on every pass through my Reservation Form
(Fiels id, name, date). so in my binding I added
************************************************
 <fb:insert-node>
        <reservation id="new" from="" to="" by="" for="" board=""/>           
    </fb:insert-node> 
 <fb:value id="for" path="reservation[@id='new']/@for"/>
    
    <fb:value id="resafrom" path="reservation[@id='new']/@from">
        <fd:convertor datatype="date" type="formatting">
            <fd:patterns>
                <fd:pattern>yyyyMMdd</fd:pattern>
            </fd:patterns>
        </fd:convertor>
    </fb:value>
 
   <fb:value id="by" path="reservation[@id='new']/@by"/>

************************************************************

The only way i managed to insert all the data into my new reservation Node
is to have the id="new" and then direct the paths to this id value.

But I'm sure this can be done directly??? on the fly with the insert node

Thx for your thoughts
Tibor


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms:fb:insert-node???

Posted by oceatoon <t....@systheo.com>.
Thanks Marc for the confirmation,

In this case I found a very ugly but in the end "get what I want" solution.

in my model I always keep an empty "reservation" node with an attribute I
use to integrate the new data, once the old empty node is overriden,I then
insert again a new empty reservation node for the next time around meaning
I always have this empty reservation node.

Just one important thing is to put the insert-node at the end of the bind
since its execution on binding is sequential, I want my empty tag to be
inserted last.

Ugly :( but it works :) 
****************************************************
here's the example bind:
my constant empty tag is recognised by its from value at new, from will be a
date so there"s no ambiguity
//I fill all the tags in the empty reservation
  <fb:value id="resato" path="reservation[@from='new']/@to"/>
    <fb:value id="for" path="reservation[@from='new']/@for"/>
    <fb:value id="by" path="reservation[@from='new']/@by"/>
//finish by filling the from attribute
    <fb:value id="resafrom" path="reservation[@from='new']/@from"/>
//then I insert a new empty node
    <fb:insert-node>
        <reservation from="new" to="" by="" for="" board="">
            <meal date="" breakfast="" lunch="" diner=""/>
        </reservation>
    </fb:insert-node>
******************************************************

Tib



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms:fb:insert-node???

Posted by Marc Portier <mp...@outerthought.org>.

oceatoon wrote:

> Hi everyone 
> 
> I'm trying to generate a new node on every pass through my Reservation Form
> (Fiels id, name, date). so in my binding I added
> ************************************************
>  <fb:insert-node>
>         <reservation id="new" from="" to="" by="" for="" board=""/>           
>     </fb:insert-node> 
>  <fb:value id="for" path="reservation[@id='new']/@for"/>
>     
>     <fb:value id="resafrom" path="reservation[@id='new']/@from">
>         <fd:convertor datatype="date" type="formatting">
>             <fd:patterns>
>                 <fd:pattern>yyyyMMdd</fd:pattern>
>             </fd:patterns>
>         </fd:convertor>
>     </fb:value>
>  
>    <fb:value id="by" path="reservation[@id='new']/@by"/>
> 
> ************************************************************
> 
> The only way i managed to insert all the data into my new reservation Node
> is to have the id="new" and then direct the paths to this id value.
> 
> But I'm sure this can be done directly??? on the fly with the insert node
> 

nope, I'm afraid this pretty much is the way how one would need to do it 
to date, and I'ld have to admit it's not all that elegant,

just a use case that wasn't considered

(you just started me thinking on a more elegant way for this, 
suggestions are welcomed)


regards,
-marc=

> Thx for your thoughts
> Tibor
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org