Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the variable definition, it is possible to specify just a "literal" value or an XPath expression over the payload. It is possible to even specify a registry key or a registry key combined with an XPath expression that selects the value of the variable. By using the key attribute of the variable, it is possible to bind an XML document located in the registry so that in the transformation, that too can be used. The name of the variable corresponds to the name of variable declaration in the XQuery script. The type of the variable must be a valid type defined by the JSR-000225 (XQJ API).

...

Table of Contents
maxLevel3
minLevel3

...

styleborder:1
locationtop
typeflat
separatorpipe

...

Syntax

Code Block
XML
XML

<xquery key="string" [target="xpath"]>
    <variable name="string" type="string" [key="string"] [expression="xpath"] [value="string"]/>?
</xquery>

...

UI Configuration

  • Key Type - Specifies either Static or Dynamic Key type.
  • Key - The key that represents the XQuery transformation. It can be chosen either from the Configuration Registry or Governance Registry. Refer to more information about the Registry Browser in Namespace.
  • Target -Specifies the node of the message that should be transformed using an XPath expression.

    Info
    titleTip

    Default to the first child of the SOAP body.

    Info
    titleTip

    You can follow this link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor," where you can provide any number of namespace prefixes and URL that you have used in the XPath expression.

...

Info
titleNote

You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.

...

Examples

1.

Code Block
XML
XML

<xquery key="xquery\example.xq">
      <variable name="payload" type="ELEMENT"/>
</xquery>

...

A variable definition that picks an XML resource from the registry using key misc/commission.xml and binds into XQuery Runtime so that it can be accessed within the XQuery script.

3.

Code Block
XML
XML

<variable name="price" type="DOUBLE" expression="self::node()//m0:return/m0:last/child::text()" xmlns:m0="http://services.samples/xsd"/>

A variable that value is calculated from the current message SOAP Payload using an expression. The value is of type "double" in this case.

Excerpt
hiddentrue

Description of the XQuery Mediator in WSO2 ESB.