Last updated

Formula - xpath

xpath('Expression',body) Formula function used to navigate over nodes in any XML structure and extract data. Simply its implemented XPath as it is elsewhere with more advance features added by Formula Plugin.

Quick example

Let's get you started with the following simple demonstration example valid for this Formula plugin. For other and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result



Text Data xpath expression Unique values


  • Extract single or multiple unique values from Content.
  • Uses many regular XPath expression as defined by W3C
  • Can be applied on any valid Content that return XML data structure; review Formula user guide for complete list of functions.

This plugin loads the entire message into RAM, so make sure to apply this function on smaller messages only

How to use

In order to use the xpath function the Content parameter should contain valid Xml data structure (otherwise it will fail and you will end up with garbage result). But first and foremost we have to configure the Formula plugin:

  • Select Formula as expression type plugin.
  • Write down the expression to use in the 'Expression' text area.
  • Input a proper Content as parameter to the function.


Use the xpath function with any of the following parameters:

  • From Message Body: xpath('Expression ',body)

  • From Message Context: xpath('Expression',context('MessageContextKey'))

  • Result from previous Formula operation xpath('Expression',SomeOtherNestedFormulaFunction(Content))


Below you will find different common examples for how to use the xpath function.

Body as Content

The body content is simple XML structure, by using the provided expression the result will be 3.

e.g. xpath('/Id',body)

Message Body




Context as Content

The Message context value is XML with one node and the key is "id", by using the provided expression the result will be 3.

e.g. xpath('/Id',context('id')) xpath_simpleParameter_MessageContext

Message Context Value




Formula Function as Content

The body content is base64encode XML structure and the expression parameter is "Orders/Id", by using the provided expression the result will be 3, 6.

e.g. xpath('/Orders/Id',base64decode(body)) xpathNodes_multiple_body_nestingFunction

Message Body




Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?