ReplaceClause

Replace a node.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

ReplaceClause

graphics/ReplaceClause.png

Expr Expr

Description

A ReplaceClause is part of an UpdateExpr and contains two expressions: the first one determines the update node at which the replace operation should take place. The second expression evaluates to a node that is used as replacement.

Examples

  • Replace the title of the book "TCP/IP Illustrated":

    update replace input()/bib/book/title[. = "TCP/IP Illustrated" ]
              with <title>TCP/IP Illustrated I. The Protocols"</title>

    Any title element nodes that satisfy the predicate expression will be replaced by the new title node.

  • Replace the year attribute of the book with the title "TCP/IP Illustrated":

    update replace input()/bib/book[title = "TCP/IP Illustrated"]/@year
              with attribute year {"2003"}