cts:element-walk( $node as node(), $element as xs:QName*, $expr as item()* ) as node()
Returns a copy of the node, replacing any elements found with the specified expression.
There are two built-in variables to represent an element match. These variables can be used inline in the expression parameter.
$cts:node
aselement()
The matching element node.
$cts:action
asxs:string
Use
xdmp:set
on this to specify what should happen next
- "continue"
- (default) Walk the next match. If there are no more matches, return all evaluation results.
- "skip"
- Skip walking any more matches and return all evaluation results.
- "break"
- Stop walking matches and return all evaluation results.
(: Replace every 'name' element with the text "Mary" :) let $x := <p>Dear <name/>, thank you for your interest.</p> return cts:element-walk($x, xs:QName("name"), "Mary") => <p>Dear Mary, thank you for your interest.</p>
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.