diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index c4f9b53e9..9ce922d57 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -4857,7 +4857,7 @@ return normalize-unicode(concat($v1, $v2)) - + @@ -4866,22 +4866,18 @@ return normalize-unicode(concat($v1, $v2)) focus-independent -

Returns a string created by concatenating the items in a sequence, with a defined - separator between adjacent items.

+

Returns a string created by concatenating the items in a sequence, + with an optional separator between adjacent items.

-

If the second argument is omitted or an empty sequence, the effect is the same as - calling the two-argument version with $separator set to a zero-length - string.

-

The coercion rules ensure that the supplied $values argument is first converted to - a sequence of atomic items by applying atomization.

+

The coercion rules ensure that the supplied $values argument is first + converted to a sequence of atomic items by applying atomization.

The function then returns an xs:string created by casting each item - in the atomized sequence to an xs:string, - and then concatenating the result strings in order, - using the value of $separator as a - separator between adjacent strings. If $separator is the zero-length - string, then the items in $values are concatenated without a separator.

- + in the atomized sequence to an xs:string, and then concatenating the + result strings in order, using the string values of $separator as a + separator between adjacent strings. If $separator is an empty sequence or + a single zero-length string, then the items in $values are concatenated + without a separator.

If $values is the empty sequence, the function returns the @@ -4896,8 +4892,8 @@ return normalize-unicode(concat($v1, $v2)) - string-join(('Now', 'is', 'the', 'time', '...'), ' ') - "Now is the time ..." + string-join(('Now', 'is', 'the', 'time'), ('?', '!')) + "Now?!is?!the?!time" @@ -4923,11 +4919,7 @@ return normalize-unicode(concat($v1, $v2)) <doc> - <chap> - <section xml:id="xyz"/> - </chap> -</doc> + ><doc><chap><section xml:id="xyz"/></chap></doc> $doc//@xml:id @@ -4943,6 +4935,11 @@ return normalize-unicode(concat($v1, $v2)) + + +

The second argument can now be a sequence.

+ + @@ -14442,11 +14439,11 @@ filter($input, fn($item, $pos) { $pos gt 1 }) - + - + - + @@ -14458,47 +14455,46 @@ filter($input, fn($item, $pos) { $pos gt 1 })

Inserts a separator between adjacent items in a sequence.

-

The function returns the value of head($input), tail($input) ! ($separator, .).

+

The function inserts a separator between adjacent items in a sequence. + The input is returned unchanged if $separator is the empty sequence + or if $input contains less than two items.

for-each($input, fn($item, $pos) { - if ($pos eq 1) - then $item - else ($separator, $item) + if ($pos gt 1) { $separator }, + $item }) - -

If $input contains less than two items then it is returned unchanged.

-

If $separator is the empty sequence then $input is returned unchanged.

-

For example, in XQuery, fn:intersperse(para, <hr/>) would insert - an empty hr element between adjacent paragraphs.

-
- intersperse(1 to 5, "|") + join(1 to 5, "|") (1, "|", 2, "|" , 3, "|", 4, "|", 5) - intersperse((), "|") + join((), "|") () - intersperse("A", "|") + join("A", "|") "A" - intersperse(1 to 5, ()) + join(1 to 5, ()) (1, 2, 3, 4, 5) - intersperse(1 to 3, ("⅓", "⅔")) + join(1 to 3, ("⅓", "⅔")) (1, "⅓", "⅔", 2, "⅓", "⅔", 3) + +

Insert an empty hr element between adjacent paragraphs:

+ )]]> +
-

New in 4.0

+

New in 4.0

@@ -27080,6 +27076,7 @@ $array + @@ -27088,16 +27085,22 @@ $array focus-independent -

Concatenates the contents of several arrays into a single array.

+

Concatenates the contents of several arrays into a single array, with an optional + separator between adjacent members.

-

Informally, the function concatenates the members of several arrays into a single array.

- +

Informally, the function concatenates the members of several arrays into a single array. + If a separator is supplied, its members are inserted before the members of the second + and the following arrays.

+array:of-members( + for-each($arrays, fn($array, $pos) { + if ($pos gt 1) { array:members($separator) }, + array:members($array) + }) +) + ]]> @@ -27120,6 +27123,16 @@ $array array:join(([ "a", "b" ], [ [ "c", "d" ] ])) [ "a", "b", [ "c", "d" ] ] + + array:join(([ 1 ], [ 2, (3, 4) ]), [ 7, (8, 9) ]) + [ 1, 7, (8, 9), 2, (3, 4) ] + + + array { 1 to 3 } +=> array:split() +=> array:join([ () ]) + [ 1, (), 2, (), 3 ] +
diff --git a/specifications/xpath-functions-40/src/xpath-functions.xml b/specifications/xpath-functions-40/src/xpath-functions.xml index d9044464a..11713d55e 100644 --- a/specifications/xpath-functions-40/src/xpath-functions.xml +++ b/specifications/xpath-functions-40/src/xpath-functions.xml @@ -5514,12 +5514,12 @@ correctly in all browsers, depending on the system configuration.

--> - - - + + +