# XQuery Mediator

The XQuery mediator can be used to perform an XQuery transformation. The 'key' attribute specifies the XQuery transformation, and the optional 'target' attribute specifies the node of the message that should be transformed. This defaults to the first child of the SOAP body of the payload. The 'Variables for the XQuery mediator' define values/expressions that could be bound to the dynamic context of the XQuery engine in order to access those variables through the XQuery script.

Figure1: XQuery Mediator

- Key: The key that represent the xquery transformation.
- Target: (optional) Specify the node of the message that should be transformed using an xpath expression. ( default to the first child of the SOAP body ) The namespace prefixes used in the expression can be defined by clicking the namespaces link in front of the 'Target' input field.

Variables for the XQuery Mediator: Defines values/expressions that could be bound to the dynamic context of the XQuery engine in order to access those variables through the XQuery script.

Figure1: XQuery Mediator - Adding Variables

You have the following option in a variable.

- Variable Type: The 'type' of the variable must be a valid type defined by the JSR-000225 (XQJ API).

  The supported types are:

  1. XQItemType.XQBASETYPE_INT->INT
  2. XQItemType.XQBASETYPE_INTEGER->INTEGER
  3. XQItemType.XQBASETYPE_BOOLEAN->BOOLEAN
  4. XQItemType.XQBASETYPE_BYTE->BYTE
  5. XQItemType.XQBASETYPE_DOUBLE->DOUBLE
  6. XQItemType.XQBASETYPE_SHORT->SHORT
  7. XQItemType.XQBASETYPE_LONG->LONG
  8. XQItemType.XQBASETYPE_FLOAT->FLOAT
  9. XQItemType.XQBASETYPE_STRING->STRING
  10. XQItemType.XQITEMKIND_DOCUMENT->DOCUMENT
  11. XQItemType.XQITEMKIND_DOCUMENT_ELEMENT->DOCUMENT_ELEMENT
  12. XQItemType.XQITEMKIND_ELEMENT->ELEMENT
- Variable Name: The name of the variable should correspond to the name of variable declaration in the XQuery script.
- Value Type: Whether the value of the variable is a static value or an expession.
- Value/Expression: Static value or the expression.
- Registry Key: Key, if the value is retrieved from the registry.
- NSEditor: Defines the namespaces for the prefixes used in the xpath query.
- Action: Delete the variable.