Supported XPath Functions

Some of the steps in the Step Palette let you define expressions for a calculation or value assignment. In these expressions, you can use any of the functions or operators that are available in the step Property Editor.

The functions in the Functions list in the step Property Editor are XPath functions. Only XPath 1.0 functions are currently supported. XPath 2.0 functions are not supported.

Note: Some function names in SBM Composer differ from the names in the XPath standard. For example, NORMALIZESPACE() is the SBM Composer name for the normalize-space() XPath function.
The following table describes the supported XPath 1.0 functions.
Function Description
BOOLEAN() Returns a Boolean value for a number, string, or array. Numbers that are not equal to 0 and strings that are not null or empty always return true.

For example, BOOLEAN(0) returns false, and BOOLEAN("false") returns true.

CEILING() Returns the smallest integer that is greater than or equal to the number argument.

For example, CEILING(2.35) returns 3.

CONCAT() Returns the concatenation of two or more strings.

For example, CONCAT("day","light") returns "daylight".

CONTAINS() Returns true if the first string contains the second string. Otherwise, returns false.

For example, CONTAINS("XPath","Path") returns true.

COUNT() Returns the number of elements in an array.

For example, suppose you have a Files[] array under an Issues data element. Each array element in the array stores a file name. COUNT(Issues.Files) returns 5, because there are five array elements in the array.

FLOOR() Returns the largest integer that is less than or equal to the number argument.

For example, FLOOR(2.35) returns 2.

LAST() Returns the last element in an array.

For example, suppose you have a Testers[] array under a Users data element. Each array element in the array stores the name of a software tester. Users.Testers[LAST()] returns Jim Wilson, because his name was stored in the last array element.

NORMALIZESPACE() Returns an argument string after removing leading and trailing spaces and replacing each sequence of spaces with a single space.

For example, NORMALIZESPACE(" 555-1212 ") returns "555-1212".

NOT() Reduces an argument to a Boolean expression, and then returns the opposite value.

For example, NOT(false()) returns true.

NUMBER() Returns the numeric value of an argument. The argument can be a Boolean, string, or array.

For example, NUMBER("500") returns 500.

POSITION() Returns the index position of an array that is being processed.

For example, testcase[POSITION()<=2] selects the first two test cases.

ROUND() Returns a number that is the nearest integer to the specified value. If there are two such numbers, the greater one is returned.

For example, ROUND(5.24) returns 5, and ROUND(6.5) returns 7.

STARTSWITH() Returns true if the first string starts with the second string. Otherwise, returns false.

For example, STARTSWITH("XPath","XP") returns true.

STRING() Returns the string value for a Boolean or number.

For example, STRING(1117) returns "1117".

STRINGLENGTH() Returns the number of characters in a string.

For example, STRINGLENGTH("HOLIDAY") returns 7.

SUBSTRING() Returns a substring from the starting position to the provided length. The index of the first character of the string to be operated on is 1. The three arguments are the string to be operated on, the starting position, and the length. If the length (the third argument) is not provided, returns the substring from the starting position to the ending position.

For example, SUBSTRING("Salesperson",1,3) returns "Sal", and SUBSTRING("Salesperson",4) returns "esperson".

SUBSTRINGAFTER() Returns the remaining characters in the first string after the second string occurs in it.

If the first string does not contain the second string, an empty string is returned.

For example, SUBSTRINGAFTER("555-1212","-") returns "1212".

SUBSTRINGBEFORE() Returns the characters in the first string before the second string occurs in it.

If the first string does not contain the second string, an empty string is returned.

For example, SUBSTRINGBEFORE("555-1212","-") returns "555".

SUM() Returns the sum of the numeric values of each element in the array.

For example, suppose you have a SalesTax[] array under a Taxes data element. Each array element in the array stores the sales tax amount from a transaction. SUM(Taxes.SalesTax) returns 100.00, because there are four array elements in the array, with values of 20, 40, 25, and 15 respectively.

TRANSLATE() Returns the first string with occurrences of characters in the second string replaced by the character at the corresponding position in the third string.

For example, TRANSLATE("bat","abc","ABC") returns "BAt".

Related Topics

About the Expression Editor