> Hi guys
>
> I'm creating a new XQuery script which will update a document with a
> comment. When doing this, I need to:
> * check whether certain parameters have been set, returning an
> error if they're missing
for $param in request:get-paramater-names()
let $value := request:get-parameter($param, ()) return
if($value eq "")
(
<b>Error: paramater "{$param}" not set</b>
)else
(
update value $somenode with $value (: hint - you could pass the node
name as the parameter name :)
),
> * check to see whether a certain "target" node is available,
> create it if not
> * update the "target" node with a new child
let $sourcenode := doc("/db/mycollection/mydoc.xml")/parentnode
if(not(exists($parentnode/targetnode)))then
(
update insert <targetnode/> into $parentnode
)
else(),
update insert <newchild>value</newchild> into $parentnode/targetnode
> * confirm the child has been created, returning result.
exists(doc("/db/mycollection/mydoc.xml")/parentnode/targetnode/newchild)
> I'm ok doing this with PHP, but moving from OOP to functional
> programming with FLOWR can be a little confusing.
<snip/>
--
Adam Retter
Devon Portal Developer
Devon Portal Project
County Hall
Exeter
Devon
EX2 4QD
t: 01392 38 3683
f: 01392 38 2966
e: adam.retter@...
w: http://www.devonline.gov.uk
|