### Replace Action Properties

In a message flow, use a replace action to replace a node or the contents of a node specified by an XPath expression. The node or its contents are replaced with the value returned by an XQuery expression.

A replace action can be used to replace simple values, elements and even attributes. An XQuery expression that returns nothing is equivalent to deleting the identified nodes or making them empty, depending upon whether the action is replacing entire nodes or just node contents.

In the Message Flow Editor, click a replace action to display its properties in the Properties view. Use these properties pages to configure the selected replace action. The pages are:

- Replace
- Comment
- Namespaces
- Variables

The Replace page has the following options:

Option | Description
--- | ---
XPath | The XPath expression used to specify the data (in the named variable) that will be replaced. To create or edit the XPath expression, click <XPath> (or the XPath_fragment, if one is already defined) to display the XPath Expression Editor.
Variable | Enter a context variable.
Expression | The XQuery expression used to create the data that replaces the data specified by the XPath in the named variable. To create or edit an expression, click <Expression> (or the expression_fragment, if one is already defined) to display the XQuery/XSLT Expression Editor.
Replace entire node or Replace node contents | When you finish editing the XQuery expression, select one of the options: Replace entire node-to specify that the nodes selected by the XPath expression you defined are replaced along with all of its contents Replace node contents-to specify that the node is not replaced; only the contents are replaced.
Note: | Selecting the Replace node contents option and leaving the XPath field blank is more efficient than selecting the Replace entire node option and setting the XPath to `./*`

Use the Comment page to add a comment, if desired:

Use the Namespaces page to see a list of defined namespaces or to create a new one.

Use the Variables page to see a list of defined context variables or to create a new one. For more information about context variables, see Message Context in the AquaLogic Service Bus User Guide.