Ben Pope писал(а):

Hi,

I don't seem to be able to get my head around binding cross-referenced data

I purpose you to try this approach.


Use xinclude (or cinclude) transformer:
<rooms>
<room id="0">
<name>Lounge</name>
<xi:include
href="#xpointer(/project/people/person[2])"/>
<xi:include
href="#xpointer(/project/people/person[3])"/>
</room>
<room id="1">
<name>Kitchen</name>
<xi:include
href="#xpointer(/project/people/person[1])"/>
</room>
</rooms>


In this case form model may looks like this (don't know if this works):
<fd:form
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
<fd:repeater id="people">
<fd:widgets>
<fd:output id="id">
<fd:datatype base="long"/>
</fd:output>
<fd:output id="href">
<fd:datatype base="string"/>
</fd:output>
<fd:booleanfield id="select">
<fd:label>Select</fd:label>
</fd:booleanfield>
</fd:widgets>
</fd:repeater>


<fd:repeater-action id="addperson" action-command="add-row"
repeater="contacts">
<fd:label>Add</fd:label>
</fd:repeater-action>


<fd:repeater-action id="removeperson" action-command="delete-rows"
repeater="contacts" select="select">
<fd:label>Remove</fd:label>
</fd:repeater-action>
</fd:widgets>
</fd:form>


And binding (check if this works):
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding";
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
xmlns:xi="http://www.w3.org/2001/XInclude";
path="/project/rooms/room[1]" >
<fb:repeater id="people"
parent-path="people"
row-path="xi:include">


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


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


<fb:on-delete-row>
<fb:delete-node />
</fb:on-delete-row>


<fb:on-insert-row>
<fb:insert-node>
<xi:xinclude id="" href=""/>
</contact>
</fb:insert-node>
</fb:on-insert-row>
</fb:repeater>


</fb:context>

Timur

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to