concat

Concatenates two or more strings

Description

The fn:concat function requires at least two arguments (which can be the empty sequence), and accepts an unlimited number of additional arguments. This is the only XQueryXPath 2.0 function that has a flexible number of arguments, for compatibility with XPath 1.0. Arguments that are not of type xs:string will be cast to xs:string.

The function does not accept a sequence of values, just individual atomic values passed as separate arguments. To concatenate a sequence of strings, use the fn:string-join function.

Parameters

Description

arg1:string()

the first value to concatenate

arg2:string()

the second value to concatenate

arg3:string()

the (optional) third value to concatenate

argN:string()

any number of arguments are allowed

Examples

XPath

Results

concat(‘a’)

Error XPST0017

concat(‘a’, ‘b’)

ab

concat(‘a’, ‘b’, ‘c’)

abc

concat(‘a’, (), ‘b’, ‘’, ‘c’)

abc

concat( (‘a’, ‘b’, ‘c’) )

Error XPST0017

concat(‘a’, <x>b</x>, ‘c’)

abc

See Also