Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 


SAP Cloud Platform Integration already offers capabilities through Filter component to filter required node or node list or value of specific node from the incoming XML message.

This blog is to demonstrate the usage of XPath 3.1 capabilities (enterprise and basic editions) in the Filter component to extract information from an incoming message.

With September 2019 release (v3.15.x), the filter component has been enriched by leveraging XPath 3.1 capabilities. This release is planned to reach customers around 1st week of September. The Filter component usage has been described in the SAP Help Portal (see Filter 1.1)

With the movement to Saxonica 9.x Enterprise edition (EE) in Cloud Platform Integration, we have leveraged the XPath 3.1 license capability in the Filter component version 1.1. Please refer the XPath 3.1 features in Saxon 9.x product matrix.

In this blog, I would like to describe some distinctive capabilities of XPath 3.1 that can be leveraged in Filter component. For detailed understanding on XPath 3.1 capabilities, please refer to this link New features in XPath 3.1

The distinctive changes that you will notice in the integration flow tooling. Assuming that you have modeled the integration flow by adding a Filter component from the palette and you notice the version of the flow step is 1.1.

Now let’s have a look at some of the capabilities of XPath 3.1 features and experience their usage in Filter component.

Use cases:

Case# 1: Filter the incoming XML message using the filter function.

What is filter function? - Returns those items from the sequence $seq for which the supplied function $f returns true. More details on the syntax and usage of filter function in XPath expression -

Let's understand this function with a simple example.


Payload used as an input.

Define XPath Expression:


XPath Expression - filter(/Root/Record/Data1, function($a) {$a = '2'})

Value Type - Nodelist


Expected Node is filtered.


Case# 2: Sort the incoming XML message using the sort function before filtering the node or list of nodes.

What is sort function? - Sorts a supplied sequence, based on the value of a sort key supplied as a function, using the supplied collation. More details on the syntax and usage of sort function in XPath expression -

Let us understand with the below example.


Payload used as an input is not sorted.


Define the XPath Expression:


XPath Expression - sort(/Root/Record)

Value Type - Nodelist


Records are sorted.


Case# 3: Group or concatenate the incoming data based on certain condition by making the dynamic function call using ‘apply’ function.

What is apply function? - Makes a dynamic call on a function with an argument list supplied in the form of an array. More details on the syntax and usage can be found here -

Let us understand the usage of this function with a simple example.

Define XPath Expression:

XPath Expression - apply(concat#3, ["a", "b", "c"])

Value Type - String




There are higher order functions other than filter, apply and sort that one can leverage to address various use cases through filter component.

Please refer this documentation for more details on higher order functions.


Arrow Operator:

One of the most interesting capabilities of XPath 3.1 is the Arrow operator. With this operator, you can simplify the complex XPath expression. An arrow operator applies a function to the value of an expression, using the value as the first argument to the function.

This syntax is particularly helpful when applying multiple functions to a value in turn. More details on Arrow operator.

Let us understand the usage of an Arrow Operator with a simple example.


  • status – ‘success’. status is the property of Type 'Constant' defined in the Content Modifier which will act as an input to the Filter component.

Define XPath Expression in the filter component to convert the value into upper case and then convert string to unicode normalization, further tokenize as well.

XPath Expression - $status => upper-case() => normalize-unicode() => tokenize("\s+")

Value Type – String




As we know Filter is a very useful component, which can be used for data validation or filter and group incoming XML based on some condition. With the movement to Saxonica 9.x EE, XPath 3.1 licensed capability functions can be leveraged in the filter component version 1.1 which has been explained above with different scenarios. In coming months, we will also leverage XPath 3.1 enterprise capabilities to other integration components such as Content Modifier, Write Variables, Splitters, Router and so on.

We will keep you posted if there are updates.

See you again with another blog on exciting new features from Cloud Integration!

Looking forward to your questions, remarks and feedback.


Some of the XPath 3.1 functions, which has been used and depicted in this blog was meant to educate the usage of those functions along with its syntax. Please refer to  Saxonica documentation to know more on other XPath functions with EE capabilities and use them accordingly in the filter component which can address your use cases.

1 Comment