Returns the concatenation of the string values of the arguments.
fn:concat
( $arg1
as xs:anyAtomicType?
,$arg2
as xs:anyAtomicType?
,$...
as xs:anyAtomicType?
xs:string
This function accepts two or more xs:anyAtomicType
arguments and casts each
one to xs:string
. The function returns the xs:string
that is
the concatenation of the values of its arguments after conversion. If any argument is
the empty sequence, that argument is treated as the zero-length string.
The fn:concat
function is specified to allow two or more arguments, which
are concatenated together. This is the only function specified in this document that
allows a variable number of arguments. This capability is retained for compatibility
with .
The expression fn:concat('un', 'grateful')
returns "ungrateful"
.
The expression fn:concat('Thy ', (), 'old ', "groans", "", ' ring',
' yet', ' in', ' my', ' ancient',' ears.')
returns "Thy old groans ring yet in my ancient ears."
.
The expression fn:concat('Ciao!',())
returns "Ciao!"
.
The expression fn:concat('Ingratitude, ', 'thou ', 'marble-hearted', ' fiend!')
returns "Ingratitude, thou marble-hearted fiend!"
.
The expression fn:concat(01, 02, 03, 04, true())
returns "1234true"
.
The expression 10 || '/' || 6
returns "10/6"
.
As mentioned in Unicode normalization is not automatically
applied to the result of fn:concat
. If a normalized result is required,
fn:normalize-unicode
can be applied to the xs:string
returned by fn:concat
. The following XQuery:
where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈", will return:
"I plan to go to Mu?nchen in September"
where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈". It is worth noting that the returned value is not normalized in NFC; however, it is normalized in NFD.
However, the following XQuery:
where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈", will return:
"I plan to go to München in September"
This returned result is normalized in NFC.