Skip to Content
The blog post has been successfully updated.
Technical Articles
Author's profile photo Gunther Stuhec

Integration Advisor – List of supported XSLT elements and XPath functions

The main aim of Integration Advisor is to create mapping guidelines with any additional coding. Further increments will be provided in the next releases. As long as not all concepts are implemented, it is necessary to use XSLT and XPath functions for these missing concepts such as for comparing or manipulating input values.

Not all XSLT or XPath functions are supported or useful for using it in the mapping elements. This blog gives you an overview list of all supported XSLT 2.0 elements and XPath 2.0 functions, which can be used in tab function of a created mapping elements in the mapping guideline.For better readability, these elements and functions are separated in categories and you can find the details in further blogs. .

Belongs%20to%20the%20Mapping%20Guideline

Belongs to the Mapping Guideline

Some conventions

A XSLT related element has the prefix xsl and a XPath related function doesn’t have a prefix.

In order to understand the behavior of the functions following conventions are considered:

  • Node – A node is a complete node starting with the node name and all child information. This child information could be further nodes or values.
  • Group node – This is a node with further group or leaf child nodes.
  • Leaf node – This is a node without any further child nodes. A leaf node usually carry a value.
  • Value – A value is the data of a given leaf node.
  • Input/Ouput – Input and output are the instances of nodes and values and source MIG side that are input nodes/values or at target MIG side which are output nodes/values.
  • Sequence – It is a list of group or leaf nodes with their values. Sequence values could be also provided as a list, which are separated by a comma.
  • Context node – It os a part of the the XPath evaluation context at the input structure which is considered by the function.
  • Current node – It is node in the input structure which matches to the function expression and will be processed accordingly.

General functions

Select Values from input and create output

You’ll find a detailed explanation of the functions for selecting values from input and create to output at the blog Integration Advisor – Mapping element functions, the use of xsl:copy, xsl:copy-of, xsl:sequence, or xsl:value-of

xsl:copy

The XSLT element xsl:copy creates a copy from the current node in the input into the output.

xsl:copy-of

The XSLT element xsl:copy-of is a deep copy of a node including child nodes and creates an exact copy from the current node such as element including attributes and all the children into the output. Integration Advisor does not consider this kind of behavior. In case of Integration Advisor, it is similar like xsl:sequence and xsl:value-of.

xsl:sequence

The XSLT element xsl:sequence creates a deep copy containing existing nodes, rather than constructing new nodes. Integration Advisor does not consider this kind of behavior. In case of Integration Advisor, it is similar like xsl:copy-of and xsl:value-of.

xsl:value-of

The XSLT element xsl:value-of evaluates the input node as a string and creates an output as test. Integration Advisor does not consider this kind of behavior. In case of Integration Advisor, it is similar like xsl:copy-of and xsl:sequence.

Conditions

The blog Integration Advisor – Conditions and statements in mapping element functions  provides the details of the following conditional functions as well as possible comparison operators.

xsl:choose

The XSLT function xsl:choose is similar like the if…then…else… statement. It tests multiple conditions in conjunction with at least one xsl:when that represents an “if” and optionally one xsl:otherwise that is comparable with “else”. It should be used for more complex conditions. Since Integration Advisor is just working with simple values, it makes big no difference using xsl:choose or the XPath function if…then…else… . The only difference is that xsl:choose does not require an else statement.

xsl:if

The XSLT function xsl:if represents a conditional test against the input content.

if…then…else

The XPath function if…then…else… is similar like xsl:choose. It is recommended to use this statement, if the condition is simple in where just value results are string or numeric based values and no structural nodes. Since Integration Advisor just outputs string or numeric based values, it makes no big difference to use if…then..else or xsl:choose. The only difference is that xls:choose does not need an else statement.

Set and get variables

The blog Integration Advisor – Mapping element functions, set and get variables explains the setting and getting of variables in more detail and with some examples.

xsl:param

The XSLT element xsl:param is implicitly used in Integration Advisor for getting values from the set global parameters via the tab “Global Parameters”. These set parameters can be called by $<ParamName> within another XSLT element or a XPath function.

xsl:variable

The XSLT element xsl:variable is used to declare a variable and binds a value or an expression to a name. A variable declaration can be at beginning of a mapping element function or in the middle of a function based on XSLT elements. The result or value can be called by $<VariableName> with another XSLT element or a XPath function.

Set values

You’ll find details about the function for setting values at the blog Integration Advisor – Mapping element functions, set values in output nodes

boolean($arg as item()*)

The XPath function boolean gives a result of the effective boolean value ‘true’ or ‘false’.

error()

The XPath function error function enables a stop of the execution of the XSLT or XPath processing. It also provides a specific error message. It can be used, if unexpected or invalid expression should be intercepted.

false()

The XPath function false provides the boolean value ‘false’.

not($arg as item()*)

The XPath function not returns the value ‘true’, if the effective boolean triggered by an expression is ‘false

true()

The XPath function true returns the Boolean value ‘true’.

 

Functions for analyzing and manipulating nodes

Analysis of input nodes and sequences

The details of the analysis specific functions are described in the the blog Integration Advisor – Mapping element functions for analyzing input nodes.

count($arg as item()*)

The XPath function count returns the total number of input nodes in a sequence.

distinct-values($arg as anyAtomicType)

The XPath function distinct-values returns a sequence of distinct values that are present in the given input sequence.

max($arg as anyAtomicType*[, $collation as sting]?)

The XPath function max returns the highest value in a sequence of node values.

min($arg as anyAtomicType*[, $collation as sting]?)

The XPath function min returns the lowest value in a sequence of node values.

nilled($arg as node()?)

The XPath function nilled returns the information, if the node is nilled according the W3C XML Schema conventions.

Check existence of input nodes

You can find the details of the existence checking functions at the blog Integration Advisor – Mapping element functions for checking the existence of input nodes.

empty($arg as item()*)

The XPath function empty returns a boolean ‘true’, if the sequence of the context node is empty.

exactly-one($arg as item()*)

The XPath function exactly-one checks whether the context node has exactly one item. Otherwise, it returns an error.

exists($arg as item()*)

The XPath function exists returns a boolean ‘true’, if the sequence of the context node is not empty.

one-or-more($arg as item()*)

The XPath function one-or-more tests if the context node has one or more items. Otherwise, it returns an error.

zero-or-one($arg as item()*)

The XPath function zero-or-one tests if the context node has zero or one item. Otherwise, it returns an error.

Comparison of nodes

The blog Integration Advisor – Mapping element functions for comparing nodes and values provides you all the details regarding the comparison functions.

deep-equal($arg as item()*, $arg2 as item()*[, $collation as sting]?)

The XPath function deep-equal compares the sequences of two input nodes for a deep equality.

Get nodes and names

The blog explains Integration Advisor – Mapping element functions for getting nodes and their names how to get nodes and names in more detail.

local-name()

The XPath function local-name returns the local part of a node (element/attribute) name of the actual (context) node without any namespace tokens.

name()

The XPath function name returns the node (element/attribute) name of the actual (context) node.

root()

The XPath function root returns the root node of the tree that contains the context node.

Get positions of nodes

You can read more about getting positions of nodes in the blog Integration Advisor – Mapping element functions for getting positions of nodes.

current()

The XPath function current returns current node that is supplied on the entry to the XPath expression. For an expression that does not occur within another expression, the current item is always the same as the context item.

index-of($arg1 as anyAtomicType*, $arg2 as anyAtomicType)

The XPath function index-of finds the positions of an atomic values within a sequence.

last()

The XPath function last returns an integer value that represents the number of instantiated items (repetitions) of the current context node.

position()

The XPath function position returns an integer value that represents the current position of the instantiated item in the current context node.

Manipulate input nodes

You’ll find more details about manipulating input nodes in the blog Integration Advisor – Mapping element functions for manipulating input nodes.

insert-before($arg1 as item()*, $arg2 as integer, $arg3 as item()*)

The XPath function insert-before can be used for inserting a new item into a sequence of the given context node.

remove($arg1 as item()*, $arg2 as integer)

The XPath function remove can be used for removing an existing item in the sequence of the given context node.

subsequence($arg1 as item()*, $arg2 as integer)

The XPath function subsequence returns a sequence of items from a given starting point of item and optionally a relative number of items.

reverse($arg as item()*)

The XPath function reverse can be used for creating a reverse order of the items in the input sequence of the given context node.

Functions for analyzing and manipulating Strings

Analysis of strings

You’ll find the details of the comparison and analysis functions at the blog Integration Advisor – Mapping element functions for analyzing input nodes

string-length($arg1 as item()*, $arg2 as integer, $arg3 as item()*)

The XPath function string-length returns the number of characters of the input string.

Comparing of strings

You’ll find the details of the comparison functions in the blog Integration Advisor – Mapping element functions for comparing nodes and values

compare($arg as string?, $arg2 as string?[, $collation as sting]?)

The XPath function compare returns an integer that tells, if the first input value is less, equal or greater than the second input value.

contains($arg as string?, $arg2 as string?[, $collation as sting]?)

The XPath function contains returns a boolean value ‘true’, if an input value contains a specific string, which could be another input value.

ends-with($arg as string?, $arg2 as string?[, $collation as sting]?)

The XPath function ends-with returns a boolean value ‘true’, if an input value ends with a specific string, which could be another input value.

matches($arg as string?, $pattern as string[, $collation as sting]?)

The XPath function matches returns a boolean value ‘true’, if an input value matches with a regular expression.

starts-with($arg as string?, $arg2 as string?[, $collation as sting]?)

The XPath function starts-with returns a boolean value ‘true’, if an input starts with a specific string, which could be another input value

Concatenate input strings

The blog Integration Advisor – Mapping element functions for concatenating input values gives you further explanation about the concatenation functions.

concat($arg as anyAtomicType?, $arg2 as anyAtomicType?, …, arg<n>? as anyAtomicType?)

The XPath function concat concatenates two or more input strings from two or more input values.

string-join($arg as anyAtomicType*)

The XPath function string-join concatenates a sequence of strings that are separated by an optional separator.

Conversion of input nodes

You’ll find the details and examples of the conversion specific function at the blog Integration Advisor – Mapping element functions for converting input values

string-to-codepoints($arg as string?)

The XPath function string-to-codepoints assembles a sequence of Unicode based code points from a string-based input value.

string()

The XPath function string converts a node value into string based representation.

Manipulate input strings

The blog Integration Advisor – Mapping element functions for manipulating input strings explains the specific approaches of the diverse string manipulation functions.

lower-case($arg as string?)

The XPath function lower-case converts a string-based input value into lower case.

replace($arg as string?, $pattern as string, $arg2 as string[, $flag as string?]?)

The XPath function replace replaces parts of a string in an input value that match with a regular expression.

tokenize($arg as string?)

The XPath function tokenize splits a string of an input value into separate tokes. A regular expression represents the separation pattern.

translate($arg1 as string?, $arg2 as string, $arg3 as string)

The XPath function translate replaces individual characters of a string in an input value to other, predefined individual characters.

upper-case($arg as string?)

The XPath function upper-case converts a string-based input value into upper case.

Normalize input values

You’ll find more about normalizing input values in the blog Integration Advisor – Mapping element functions for normalizing input values.

normalize-space()

The XPath function normalize-space eliminates redundant whitespaces from a string-based input value.

normalize-unicode($arg as string?)

The XPath function normalize-unicode converts the string of an input node into a normalized Unicode representation.

Trim input strings

The mapping element functions for trimming input strings are more explained in the blog Integration Advisor – Mapping element functions for trimming input strings.

substring($arg1 as string?, $arg2 as integer)

The XPath function substring returns a substring from a given starting position until the optional length.

substring-after($arg1 as string?, $arg2 as string?)

The XPath function substring-after returns a substring after the first occurrence of a specified string.

substring-before($arg1 as string?, $arg2 as string?)

The XPath function substring-before returns a substring before the first occurrence of a specified string.

Functions for Numeric Input Values

Calculation

The details of the calculation functions are in the blog Integration Advisor – Mapping element functions for calculations.

abs($arg as numeric?)

The XPath function abs returns a numeric absolute value of given numeric based input value.

avg($arg as anyAtomicType*)

The XPath function avg returns a numeric average value of a sequence of numeric based input values.

sum($arg as anyAtomicType*)

The XPath function sum returns a numeric total value of a sequence of numeric based input values.

Convert of numeric values

The details of converting functions are described in blog Integration Advisor – Mapping element functions for converting input values

number()

The XPath function number a string-based input value into a number.

format-number($arg1 as numeric?, $arg2 as string)

The XPath function format-number formats the numeric based input number into string based output format specified by a picture string.

Rounding of numeric values

The details of the rounding functions are in the blog Integration Advisor – Mapping element functions for rouding numeric input values.

ceiling($arg as numeric?)

The XPath function ceiling returns a rounded-up integer value of a numeric based input value.

floor($arg as numeric?)

The XPath function floor returns a rounded-down integer value of a numeric based input value.

round($arg as numeric?)

The XPath function round returns a rounded integer value of a numeric based input value. The rounded integer is the nearest integer to the input value.

round-half-to-even($arg as numeric?)

The XPath function round-half-to-even returns a rounded numeric value that is the nearest to the whole number.

sum($arg as anyAtomicType*)

The XPath function sum returns a numeric total value of a sequence of numeric based input values.

 

Functions for Date, Time and/or Duration

Concatenate

Further details about concatenating date and time values are at the blog Integration Advisor – Mapping element functions for concatenating input values.

dateTime($arg1 as date?, $arg2 as time?)

The XPath function dateTime creates a date, time value based on primitive type xsd:dateTime from a value that is based on primitive type xsd:date and another value that is based on primitive type xsd:time.

Adjusting

You’ll find the detailed explanations of adjusting date and/or times at the blog Integration Advisor – Mapping element functions for adjusting input dates and/or times.

adjust-dateTime-to-timezone($arg as dateTime?)

The XPath function adjust-dateTime-to-timezone adjusts the dateTime to a specific timezone, or to the original dateTime with the timezone removed.

adjust-date-to-timezone($arg as date?)

The XPath function adjust-date-to-timezone adjusts the date to a specific timezone, or to the original date with the timezone removed.

adjust-time-to-timezone($arg as time?)

The XPath function adjust-time-to-timezone adjusts the time to a specific timezone, or to the original timewith the timezone removed.

Converting of Date, Duration and/or Time

How the formatting functions work is described in the blog Integration Advisor – Mapping element functions for converting input values

format-date($arg1 as date?, $arg2 as string)

The XPath function format-date formats an input date based on on W3C XML Schema used ISO 8601 standard as an output string format using the picture string.

format-dateTime($arg1 as dateTime?, $arg2 as string)

The XPath function format-dateTime formats an input dateTime based on on W3C XML Schema used ISO 8601 standard as an output string format using the picture string.

format-time($arg1 as time?, $arg2 as string)

The XPath function format-time formats an input time based on on W3C XML Schema used ISO 8601 standard as an output string format using the picture string.

Setting

The blog Integration Advisor – Mapping element functions, set values in output nodes describes how you can set date and time stamps using the following functions.

current-date()

The XPath function current-date returns the current date with the implicit timezone based on W3C XML Schema used ISO 8601 standard.

current-dateTime()

The XPath function current-dateTime returns the current dateTime with the implicit timezone based on W3C XML Schema used ISO 8601 standard.

current-time()

The XPath function current-time returns the current time with the actual implicit based on W3C XML Schema used ISO 8601 standard.

implicit-timezone()

The XPath function implicit-timezone returns the implicit timezone in form of duration based on W3C XML Schema used ISO 8601 standard.

Conversion

You can read more about the date/time conversion specific functions at the blog Integration Advisor – Mapping element functions for converting date/time based input values

day-from-date($arg as date?)

The XPath function day-from-date returns the day from a date stamp that is based on primitive type xsd:date.

day-from-dateTime($arg as dateTime?)

The XPath function day-from-dateTime returns the day from a date stamp that is based on primitive type xsd:dateTime.

days-from-duration($arg as duration?)

The XPath function days-from-duration calculates the number of days from a value that is based on primitive type xsd:duration.

hours-from-dateTime($arg as dateTime?)

The XPath function hours-from-dateTime returns the hour portion from a date stamp that is based on primitive type xsd:dateTime.

hours-from-duration($arg as duration?)

The XPath function hours-from-duration calculates the number of hours from a value that is based on primitive type xsd:duration.

hours-from-time($arg as time?)

The XPath function hours-from-time returns the hour portion from a time stamp that is based on primitive type xsd:time.

minutes-from-dateTime($arg as dateTime?)

The XPath function minutes-from-dateTime returns the minute portion from a date stamp that is based on primitive type xsd:dateTime.

minutes-from-duration($arg as duration?)

The XPath function minutes-from-duration calculates the number of minutes from a value that is based on primitive type xsd:duration.

minutes-from-time($arg as time?)

The XPath function minutes-from-time returns the minute portion from a time stamp that is based on primitive type xsd:time.

month-from-date($arg as date?)

The XPath function month-from-date returns the month from a date stamp that is based on primitive type xsd:date.

month-from-dateTime($arg as dateTime?)

The XPath function month-from-dateTime returns the month from a date stamp that is based on primitive type xsd:dateTime.

months-from-duration($arg as duration?)

The XPath function months-from-duration calculates the number of months from a value that is based on primitive type xsd:duration.

seconds-from-dateTime($arg as dateTime?)

The XPath function seconds-from-dateTime returns the second portion from a date stamp that is based on primitive type xsd:dateTime.

seconds-from-duration($arg as duration?)

The XPath function seconds-from-duration the number of seconds from a value that is based on primitive type xsd:duration.

seconds-from-time($arg as time?)

The XPath function seconds-from-time returns the second portion from a time stamp that is based on primitive type xsd:time.

timezone-from-date($arg as date?)

The XPath function timezone-from-date returns the timezone from a date stamp that is based on primitive type xsd:date.

timezone-from-dateTime($arg as dateTime?)

The XPath function timezone-from-dateTime returns the timezone from a date stamp that is based on primitive type xsd:dateTime.

timezone-from-time($arg as time?)

The XPath function timezone-from-time returns the timezone from a time stamp that is based on primitive type xsd:time.

year-from-date($arg as date?)

The XPath function year-from-date returns the year from a date stamp that is based on primitive type xsd:date.

year-from-dateTime($arg as dateTime?)

The XPath function year-from-dateTime returns the year from a date stamp that is based on primitive type xsd:dateTime.

years-from-duration($arg as duration?)

The XPath function years-from-duration calculates the number of years from a value that is based on primitive type xsd:duration.

Summary

This is just a list of the standard built-in XSLT 2.0 elements and XPath 2.0 functions. It is possible to build its own functions using xsl:function, which can be compared with the User Defined Functions. Unfortunately, Integration Advisor does not provide a possibility to build a reusable catalog of your own made functions, and there is no possibility to share your functions with other users. But both features are in the backlog, and if you have high interest that these features should come into the roadmap much sooner, please submit a new improvement request at the customer influence campaign for SAP Integration Suite, or vote for it if the requests are already submitted.

A further blog will follow soon, which will you provide a list of further useful functions, which you can just copy and paste into the function area of your mapping elements. Stay tuned.

Further Reading

Read the following blog posts for more information related to the MAG editor and the functions:

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.