To create an XQuery transformation:

  1. In the Routing Rules section, click the Select an existing mapper file or create a new one icon to the right of the Transform Using field. The Request Transformation Map dialog appears.

  2. Do one of the following:

    • If the XQuery map file (.xqy) exists, click Browse to find and select the XQuery file to use. Click OK.

    • If you are creating a new XQuery map file, click the Create Mapping icon. The Create Transformation Map dialog appears.

  3. In the Create Transformation Map dialog, select XQuery under Type.

    Figure 20-29 shows the Create Transformation Map dialog.

    Figure 20-29 Create Transformation Map Dialog

    Description of Figure 20-29 follows
    Description of "Figure 20-29 Create Transformation Map Dialog"
  4. Edit the XQuery File Name, as appropriate.

  5. Edit the XQuery Directory, as appropriate. The default directory is the SOA_Project/SOA/Transformations directory. Click Browse to browse and select the directory.

  6. Under the External Variables section, you can define the external variables for the XQuery. Click Add Variable to add a new external variable. The Add External Variable dialog appears.

    Note:

    External variables are automatically created for implicit mediator variables that are available as transformation input. For example, the mediator input request in.request automatically has an external variable for it.

    Figure 20-30 shows the Add External Variable dialog.

    Figure 20-30 Add External Variable Dialog

    Description of Figure 20-30 follows
    Description of "Figure 20-30 Add External Variable Dialog"
  7. Specify a Name, Schema, and schema Element for the external variable.

  8. Under From, choose how to map the value for the external variable. Select from one of the following:

    • Property: Lists the properties that you can select from.

    • Expression: Enables you to build an expression using mediator implicit variables, properties, and a list of functions that you can use in the expression. You can click the Invoke Expression Builder icon to launch the expression builder.

      See How to Specify an Expression for Filtering Messages and Building XPath Expressions in the Expression Builder in for more information about working with the expression builder.

    • Constant: Enables you to specify a literal value for the external variable.

    • XML Fragment: Enables you to specify XML data for the external variable.

  9. Click OK in the Add External Variable dialog to add the external variable. The Create Transformation Map dialog is populated with the external variable.

    Note:

    To edit an external variable, select it from the list and click Update Variable.

    To delete an external variable, select it from the list and click Delete Variable.

  10. Click OK in the Create Transformation Map dialog. The Request Transformation Map dialog appears, and it is populated with the Mapper File name and the external variables defined.

    Figure 20-31 shows the Request Transformation Map dialog.

    Figure 20-31 Request Transformation Map Dialog

    Description of Figure 20-31 follows
    Description of "Figure 20-31 Request Transformation Map Dialog"
  11. Click OK in the Request Transformation Map dialog. The transformation action details are added to the mediator mplan file.