cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Pope <benpop...@gmail.com>
Subject Re: Cforms:Binding to specific element and saving
Date Wed, 22 Jun 2005 17:32:24 GMT
trondal wrote:
> I want to bind to just <user id="1"> on the following xml-file:
> <users>
> 	<user id="1">
> 		<name>Johan</name>
> 	</user>
> 	<user id="2">
> 		<name>Mark</name>
> 	</user>
> </user>
> 
> Here are the sitemap whitch does the job:
> 
> <map:match pattern="modify_course">
>        <map:call function="handleForm">
>          <map:parameter name="function" value="{0}"/>
>          <map:parameter name="form-definition"
> value="modify_course_definition.xml"/>
>          <map:parameter name="documentURI"
> value="xmldb:exist:///quis/courses/courses.xml#/users/user[@id='1']"/>	
> 	   <map:parameter name="bindingURI"
> value="modify_course_binding.xml"/>
>     </map:call>
> </map:match> 
> 
> All works well until i save: "Cannot modify a resource that includes an
> XPATH expression".
> Previos samples-examples with bindings have worked well, but they all work
> on a easily identifiable path.
> How can I use Xpath to identify the element, and still save the modified
> part?  
> 
> 
> Can anybody please point me in the right direction on how to overcome this?

Hmm, if you used repeaters you could specify something like the following in your binding:

<fb:repeater id="users" parent-path="/users" row-path="/user[@id='1']" row-path-insert="/user">

Of course, your documentURI would have to change to smething more like:
  value="xmldb:exist:///quis/courses/courses.xml

Perhaps that helps?  I doubt you would want to allow them to change the id.

Ben

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


Mime
View raw message