home contribute faq download

FunctX XQuery Functions

fn:concat

Concatenates two or more strings

Google
Webxqueryfunctions.com

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.

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameTypeDescription
$arg1 xs:anyAtomicType? the first value to concatenate
$arg2 xs:anyAtomicType? the second value to concatenate
$arg3 xs:anyAtomicType? the (optional) third value to concatenate
etc. xs:anyAtomicType? any number of arguments are allowed
return value xs:string

Examples

XQuery ExampleResults
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

fn:string-joinConcatenates a sequence of strings using an optional separator

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XQuery Services

Recommended Reading:

XQuery