cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Pope" <nos...@hotmail.com>
Subject Re: Cforms, Binding & Cross-Referenced data
Date Wed, 28 Jul 2004 21:51:45 GMT
Hi,

I spent a little while looking into this and it certainly looks like a
useful way of looking at it.  I'll have a further play tomorrow evening.

One thing I'm a little unsure of though:  I was under the impression that
using XInclude would create a result with the referenced data included,
which is fine, but I then don't understand why the repeater row is over the
XInclude element, surely it would get replaced and would not appear in the
result?

I think I've missed something though, 'cos I'm not sure what the binding is
doing (path="@id", path="@href"), and if the result was new with the
XInclude elements replaced, how would it bind in the "save" direction?

I'm under the impression that as of yet Xerces/Xalan doesn't do XPointers,
so what are my alternatives?

Thanks for your time,
Ben




-----Original Message-----
From: Timur Izhbulatov [mailto:tim@yxo.ru]
Sent: 28 July 2004 11:56
To: users@cocoon.apache.org
Subject: Re: Cforms, Binding & Cross-Referenced data

Ben Pope писал(а): 

Try the following approach. 

In sitemap you use xinclude transformer. Each room element contains
<xi:include href="#xpointer(some_XPath)"/> elements.
  <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> 

Form and binding may be like this (I don't if it 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> 

<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> 

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


Mime
View raw message