Delete a node sequence.
A DeleteClause
is part of an UpdateExpr
and
deletes the node sequence that is the result of the evaluation of the
expression following the keyword delete
.
Strip all comments in the documents of the current collection:
update delete input()//comment()
Delete all books that do not have a publishing year:
update delete input()/bib/book[not(@year)]
For the sample data provided, year
is a
required attribute of the element book
, so the
expression evaluates to an empty sequence and none of the
book
elements are deleted.
Clear all element nodes in the current collection:
update delete input()//*/text()
The expression evaluates to all element nodes. Their text contents are deleted, but neither the elements themselves nor their attributes are deleted.
The following construct(s) refer to this construct: