execute-update-script
Type: Operation
Execute an XQuery updating script.
Note: this feature is experimental and subject to change.
Example
Other
{
"replace-a-note": {
"label": "Replace a note with a warning note, using XQUF!",
"steps": [
{
"type":"transform/setContextNodeIdToSelectionAncestor",
"data": {
"selectionAncestorNodeSpec": "self::note"
}
},
{
"type": "operation/execute-update-script",
"data": {
"expression":
"replace node $data('contextNode') with <note type=\"warning\">{$data('contextNode')/node()}</note>",
"contextNodeId": "{{contextNodeId}}"
}
}
]
}
}
Note: for each property in "data"
which ends with (N|n)odeId
, the actual node is retrieved and available in the query with the key without the Id
postfix.
The following updating expressions are supported, note that functions can also be updating
You can try out the updating expression on the fontoxpath playground.
You can set selection in the updating expression by using selection PIs.
Imported operation data
expression
(Required)
Type: String
The expression that should be executed. This expression is passed the
stepData
as a variable called$data
.