cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim O'Leary <>
Subject Re: Cforms, Binding & Cross-Referenced data
Date Thu, 29 Jul 2004 00:01:29 GMT
Original message from Timur Izhbulatov
Ben Pope писал(а): 

Try the following approach. 

In sitemap you use xinclude transformer. Each room element contains
<xi:include href="#xpointer(some_XPath)"/> elements.
     <room id="0">
     <room id="1">

Form and binding may be like this (I don't if it works):
<fd:repeater id="people">
      <fd:output id="id">
        <fd:datatype base="long"/>
      <fd:output id="href">
        <fd:datatype base="string"/>
      <fd:booleanfield id="select">

  <fd:repeater-action id="addperson" action-command="add-row"

  <fd:repeater-action id="removeperson" action-command="delete-rows"
repeater="contacts" select="select">

          path="/project/rooms/room[1]" > <fb:repeater id="people"

    <fb:value id="id" path="@id">
      <fd:convertor datatype="long" />

      <fb:value id="href" path="@href" />

    <fb:delete-node />

      <xi:xinclude id="" href=""/>


> Hi,
> I don't seem to be able to get my head around binding cross-referenced 
> data
> - the example below will be clearer than I can explain it in words:  
> Say I want to store some information about who is in what room, I 
> might have a data file that looks like this:
> <project>
>    <people>
>       <person id="0">
>          <name>Me</name>
>          <mentalAge>9</mentalAge>
>       </person>
>       <person id="1">
>          <name>You</name>
>       </person>
>       <person id="2">
>          <name>Him</name>
>       </person>
>    </people>
>    <rooms>
>       <room id="0">
>          <name>Lounge</name>
>          <person idref="0"/>
>          <person idref="1"/>
>       </room>
>       <room id="1">
>           <name>Kitchen</name>
>           <person idref="2"/>
>       </room>
>    </rooms>
> </project>
> Now each room has a person reference that references the person id.  
> So "You" and "Me" are in the Lounge and "Him" is in the Kitchen 
> (hopefully making some food 'cos this is making me hungry!).
> I'd like to do this:  
> http://localhost/cocoon/rooms/room?room=0
> And be able to get back a form with a repeater over all the people in 
> that room.
> The definition for said form might look like this:  
> <?xml version="1.0"?>
> <fd:form xmlns:fd="">
>    <fd:widgets>
>       <fd:field id="roomName" required="true"/>
>       <fd:repeater id="people">
>          <fd:widgets>
>             <fd:field id="personName" required="true"/>
>             <fd:booleanfield id="select"/>
>          </fd:widgets>
>       </fd:repeater>
>       <fd:repeater-action id="addPerson" repeater="people"
> action-command="add-row"/>
>       <fd:repeater-action id="removePeople" repeater="people"
> action-command="delete-rows" select="select"/>
>    </fd:widgets>
> </fd:form>
> So I would like to be able to add and remove people from a particular 
> room - it's safe to assume that the person already exists, so I 
> wouldn't be adding a people/person at any time, only a room/person.  
> But I would like to be able to manipulate their name.
> I can't establish what the binding file would look like given the 
> above data file with the cross-referencing.
> Should I be running an XSLT over the data so that for room 0 I end up
> <room id="0">
>    <name>Lounge</name>
>    <person id="0">
>       <name>Me</name>
>    </person>
>    <person id="1">
>       <name>You</name>
>    </person>
> </room>
> Which would be much easier (with my mind, at least) to create a 
> binding file for.
> If so... How do I fit that back into the old data file, retaining the 
> room/person idrefs and updating the people/person elements?
> Or can it be done "in place"?  
> This is all a new paradigm of thinking for me, I clearly haven't had 
> that click moment, if I keep plugging at it and seeing the solutions 
> to my problems it will click, I know it.
> Any help is much appreciated.  
> Ben
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:


To unsubscribe, e-mail:
For additional commands, e-mail:

This email is from Civica Pty Limited and it, together with any attachments,
is confidential to the intended recipient(s) and the contents may be legally
privileged or contain proprietary and private information. It is intended
solely for the person to whom it is addressed. If you are not an intended
recipient, you may not review, copy or distribute this email. If received in
error, please notify the sender and delete the message from your system
Any views or opinions expressed in this email and any files transmitted with
it are those of the author only and may not necessarily reflect the views of
Civica and do not create any legally binding rights or obligations
whatsoever. Unless otherwise pre-agreed by exchange of hard copy documents
signed by duly authorised representatives, contracts may not be concluded on
behalf of Civica by email. 
Please note that neither Civica nor the sender accepts any responsibility
for any viruses and it is your responsibility to scan the email and the
attachments (if any). All email received and sent by Civica may be monitored
to protect the business interests of Civica. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message