fn:string-join($arg1 as xs:anyAtomicType*) as xs:string
fn:string-join($arg1 as xs:anyAtomicType*, $arg2 as xs:string) as xs:string
If I pass an xpath like the following: fn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+"))) it will fail unless I explicitly add an empty string for the second parameter fn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+")), "") .
As stated in the spec:
The effect of calling the single-argument version of this function is the same as calling the two-argument version with $arg2 set to a zero-length string.
The function returns an xs:string created by casting each item in the sequence $arg1 to an xs:string, and then concatenating the result strings in order, using the value of $arg2 as a separator between adjacent strings. If the value of $arg2 is the zero-length string, then the members of $arg1 are concatenated without a separator.
The Spec explicitly indicates two signatures:
fn:string-join($arg1 as xs:anyAtomicType*) as xs:string
fn:string-join($arg1 as xs:anyAtomicType*, $arg2 as xs:string) as xs:string
If I pass an xpath like the following:
fn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+")))
it will fail unless I explicitly add an empty string for the second parameterfn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+")), "")
.As stated in the spec: