About Data-Element-to-Data-Element Advanced Mapping XQuery Expressions

This topic describes how to use the Mapping Rule editor, Mapping tab, Mapping subtab Configuration 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.

  • Context: The input document is a source order item during normal transformation. If invoked during forward data propagation, the input document is empty.

  • Prolog: You can declare the order item namespace in the XQuery prolog. For example:

    declare namespace prop='http://oracle.communications.centralom';
    

    You can also declare the following variable within the prolog to determine the action code.

    • You can declare $value to contain the values of the target data elements.

  • Body: The XQuery body returns one or more data element values or returns () to leave the current value unchanged.

The following example shows an XQuery expression that returns the target value of a data element based on the value of the source data element.

declare variable $value external;
if (fn:empty($value)) then ('unknown') else (fn:concat('Loc: ', $value))

The following example shows an XQuery expression that returns the target value of a data element based on characteristics of the source order item.

declare namespace prop='http://oracle.communications.centralom';
if (fn:exists(osm:properties/prop:ServicePoint/text())) 
then (fn:concat('Loc: ', fn:normalize-space(osm:properties/prop:ServicePoint/string()))) 
else ('unknown')