Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fn:string-join() fails if missing second parameter #20

Open
sigdavis opened this issue May 29, 2023 · 0 comments
Open

fn:string-join() fails if missing second parameter #20

sigdavis opened this issue May 29, 2023 · 0 comments

Comments

@sigdavis
Copy link

The Spec explicitly indicates two signatures:

  1. fn:string-join($arg1 as xs:anyAtomicType*) as xs:string
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant