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 TypeName | Type | Description |
$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 |
ExamplesXPath Example | 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 Alsofn:string-join | Concatenates a sequence of strings using an optional separator |
History |
Recommended Reading:
|