About Reverse Mapping XQuery Expressions

This topic describes how to use the Mapping Rule editor, Mapping tab, Mapping subtab, Bi-Directional Mapping subtab, XQuery subtab to write an expression that defines an advanced mapping between two data elements. This field is displayed when you select the target of a data element-to-data element mapping and select the Advanced option in the Mapping Rule Item topic, if Supports Bi-Directional Mapping is selected in the Details subtab of the Mapping tab for the selected mapping.

  • Context: The input document is empty.

  • Prolog: You can declare the following variables within the prolog to determine the action code.

    • You can declare $value to access the updated target value.

  • Body: The XQuery body returns the updated source value.

The following example shows an XQuery expression that returns () if the return value is unknown and otherwise returns the updated value.

declare variable $value external;
if ('unknown' = $value) then() else (fn:substring($value, 5))