-
☞
insert update delete
-
✎
let $doc := onetworeturn element { node-name($doc) } {$doc/*/element { 'b' } { node() }
}
let $doc := onetworeturn element { node-name($doc) } {$doc/*/element { node-name() } { () }
}
-
declare function local:strip($n as node()) as element()? {if($n instance of element()) thenelement { node-name($n) } {
$n/(@*, node())/local:strip(.)}
else ()};local:strip(XC)
☞
-
insert
replace
replace value
delete
rename
copy modify return
update ...
-
copy $... := …source… modify ... return ...…source… update ...
modify update
-
copy $c := modify (
insert node element german { 'Friede' } into $c,insert node element arabian { 'سالم' } into $c
)return $c
update insert nodes (element german { 'Friede' }, element arabian { 'سالم' }
) into .
-
insert node …source… [direction] …target…
before, after, (as first | as last)? into
✎
copy $c := document { } modify (
insert node before $c/xml,
insert node after $c/xml,
insert node as first into $c/xml,
insert node as last into $c/xml,
insert node into $c/xml
) return $c
-
replace node …target… with …source…
replace value of node …target… with …string…
☞
copy $c =: modify (
replace node $c/शीर्षक with ,
replace value of node $c/טקסט with 'Привет!'
) return element תיעוד { $c }
insert replace
-
delete node …target…
☞
copy $c := document { नमसे्त }
modify delete node $c//text()
return $c//text()
rename node …target… as …name…
copy $c := modify rename node $c as '௵'return $c
-
✎
Xfor $x in //Xreturn insert node $x after $x
$xfor $x in //*return delete node $x
✎
-
insert into insert attribute replace value rename
insert before insert after insert as first insert as last
replace node replace element content
delete
✎
update (insert node text { 'text' } into .,delete node ./node())
update (insert node text { 'text' } into b,delete node ./node())
-
for $x in //x return replace value of node $x with '㋛'
for $x in //x return replace value of node $x/text() with '㋛'
for $x in //x return replace node $x/text() with '㋛'
✎
replace replace value
(replace value of node $x with 'x',replace value of node $x with 'y')
(replace node $x with 'y',replace value of node $x with 'x')
✎
-
✎
X update replace node text() with ''
update (insert node text { '1' } into .,insert node text { '1' } into .
)
-
↯ rename node $a as 'A', rename node $a as 'B'
↯ insert node attribute a { 123 } into
↯ insert node text { 'x' } into /b
↯ replace node with
-
%updating
declare %updating function local:replace($trg, $val) {if(string($trg) eq $val) then () elsereplace value of node $trg with $val
};
for $item in //item
return local:replace($item, 'sold')
-
() error()
empty-sequence()
✎
if($doit) then delete node $sigh else 'Lucky day!'
try { insert node $a into $b } catch * { 'pity' }
delete node $a, delete node $b, db:output('success')
-
let $item := return ($item, delete node $item, $item)
☞ $item
✎
-
db:output($result as item()*)
MIXUPDATES
if(...) then data:get() else data:put()
%simple, %updating("allowed")
-
✎
db:add($db, $input, $path)
db:rename($db, $path, $newpath)
db:replace($db, $path, $input)
db:delete($db, $path)
db:create($db, $path)
db:drop($db)
db:optimize($db)
-
http://my.app.org/update ⇨http://my.app.org/update-ok ⇨ ✓ ↯
(1 to 99) ! db:create('db' || .)
(1 to 99) ! db:drop('db' || .)