Skip to content

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

Description

@sigdavis

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions