Hi Robert, thanks for the reply.
This won't work considering there may be duplicate names. I'm not
working with names at all, it was just an example, but I'm looking into
a way to uniquely identify portions of my data to make deletions and
other modification behavior a bit easier.
xdmp:request() and xdmp:request-timestamp() look interesting, but I have
yet to implement something using these. Also, seems I might be able to
use xdmp:lock-acquire() and xdmp:lock-release() on a special document
which contained an integer I could increment, and abstract it all into a
nextUniqueId() function, for example.
More research required, though.
Thanks again,
Eric
Robert Koberg wrote:
Hi,
How about something like this (inline below):
for $person in doc('/people.xml')/people/person
return
<div>
$person/@name
<a href="delete.xqy?path={ xdmp:path($person) }>delete</a>
</div>
<a href="delete.xqy?name={ $person/@name }>delete</a>
then (below)
This will give me nice delete links like
"delete.xqy?path=/people/person[1]", but in the supposed delete.xqy,
I'd want to do something similar to:
let $file := '/people.xml'
let $person := xdmp:get-request-field('path')
return
xdmp:node-delete(doc($file)/$person)
let $person-name := xdmp:get-request-field('name')
return
xdmp:node-delete(doc($file)/people/[EMAIL PROTECTED])
I realize you have simplified things (nicely) for your post, but I would
use XQuery to build JavaScript here to put the information you need per
person into a JSON object (I realize some requirement might preclude you
from using JS). Then add a click event handler for each person link.
Then, onclick, use the event handler to find the person's json object
and construct an ajax POST or DELETE (which can be converted to XML on
the client if needed) to send to the XQY.
best,
-Rob
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general