XPath Functions

 

XPath functions can be used in the Expression builder to create complex calculation or constraints. These functions are broken up into several subsets of functions which are listed below.

Context Functions and Duration/Date/Time Functions

A list of Context Functions and Duration/Date/Time functions can be found in the User Guide section named Date Calculations Using the Expression Builder.

Numeric Functions

Function
Description
Example 
absReturns the absolute value of a number.abs(3.14) will return 3.14 and abs(-3.14) will return 3.14
ceilingReturns the smallest integer that is greater than the number.ceiling(3.14) will return the integer 4
floorReturns the largest integer that is less than the number.floor(3.14) will return the integer 3
numberReturns the numeric value of the argument. The argument can be boolean, string (text), or node-set.number('100') will convert a text input of 100 to the numeric value 100
roundRounds the number to the nearest integer.round(3.14) will return the integer 3
round-half-to-evenRounds the number to the nearest even integer.round-half-to-even(0.5) will return 0 and round-half-to-even(1.5) will return 2

  

Sequence Functions

Function
Description
Example
avgReturns the average of a list of arguments.avg(1,2,3) will return 2 
countReturns the number of arguments in a list.count('a','b','c','d') will return 4
maxReturns the greatest argument from a list.max(1,2,3) will return 3 and max('a','b','c') will return c
minReturns the smallest argument from a list.min(1,2,3) will return 1 and min('a','b','c') will return a
sumReturns the numeric sum of a list of numbers or nodes from a node-set.sum(1,2,3) will return 6

  

String Functions

Function
Description
Example
compareReturns -1 if argument 1 is less than argument 2, 0 if argument 1 equals argument 2 or 1 if argument 1 is greater than argument 2compare(1,2) will return -1, compare(2,2) will return 0, compare(3,2) will return 1
concatCombines a list of arguments into a single string (text).concat('Coghead ','is ','FUN!') will return 'Coghead is FUN!'
containsReturns true if string1 contains string 2 or returns false if string1 does not contain string2.contains('Coghead','Cog') will return true, contains('Coghead','Coglet') will return false
lower-caseConverts the string to all lower case letters.lower-case('COGHEAD') will return 'coghead'
matchesReturns true if argument 1 matches the pattern of argument 2 or returns false if argument 1 does not match the pattern of argument 2.matches('Coghead','Cog') will return true
replaceReturns a string (text) that replaces all the occurrences of argument 2 with the value in argument 3 in argument 1.replace('Application','p','^') will return 'A^^lication'
string-joinCombines a list of string (text) arguments into a single string (text).string-join('Coghead ','is ','FUN!') will return 'Coghead is FUN!'
string-lengthReturns a numeric value of the length of a string.string-length('Coghead') will return the number 7
substringReturns a specified length of an argument from a specified start point.substring('Coghead',4,4) will return 'head', substring('Coghead',1,3) will return 'Cog'
substring-afterReturns the remaining length of an argument after argument 2 occurs in the string.substring('Coghead','e') will return 'ad'
substring-beforeReturns the beginning of an argument before argument 2 occurs in the string.substring('Coghead','h') will return 'Cog'
upper-caseConverts the text string argument to capital letters.upper-case('coghead') will return 'COGHEAD'