Skip to content

Commit

Permalink
Join functions: Revisions. #868
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianGruen committed Oct 24, 2024
1 parent 3a1b71e commit a9c9302
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
42 changes: 18 additions & 24 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4857,7 +4857,7 @@ return normalize-unicode(concat($v1, $v2))</eg>
<fos:signatures>
<fos:proto name="string-join" return-type="xs:string">
<fos:arg name="values" type="xs:anyAtomicType*"/>
<fos:arg name="separator" type="xs:string*" default='()'/>
<fos:arg name="separator" type="xs:string?" default='""'/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand All @@ -4866,12 +4866,15 @@ return normalize-unicode(concat($v1, $v2))</eg>
<fos:property>focus-independent</fos:property>
</fos:properties>
<fos:summary>
<p>Returns a string created by concatenating the items in a sequence,
with an optional separator between adjacent items.</p>
<p>Returns a string created by concatenating the items in a sequence, with a defined
separator between adjacent items.</p>
</fos:summary>
<fos:rules>
<p>The coercion rules ensure that the supplied <code>$values</code> argument is first
converted to a sequence of atomic items by applying atomization.</p>
<p>If the second argument is omitted or an empty sequence, the effect is the same as
calling the two-argument version with <code>$separator</code> set to a zero-length
string.</p>
<p>The coercion rules ensure that the supplied <code>$values</code> argument is first converted to
a sequence of atomic items by applying atomization.</p>
<p>The function then returns an <code>xs:string</code> created by casting each item
in the atomized sequence to an <code>xs:string</code>, and then concatenating the
result strings in order, using the string values of <code>$separator</code> as a
Expand All @@ -4892,8 +4895,8 @@ return normalize-unicode(concat($v1, $v2))</eg>
</fos:example>
<fos:example>
<fos:test>
<fos:expression>string-join(('Now', 'is', 'the', 'time'), ('?', '!'))</fos:expression>
<fos:result>"Now?!is?!the?!time"</fos:result>
<fos:expression>string-join(('Now', 'is', 'the', 'time', '...'), ' ')</fos:expression>
<fos:result>"Now is the time ..."</fos:result>
</fos:test>
</fos:example>
<fos:example>
Expand Down Expand Up @@ -7066,11 +7069,6 @@ Tak, tak, tak! - da kommen sie.
</fos:test>
</fos:example>
</fos:examples>
<fos:changes>
<fos:change issue="895" PR="901" date="2023-12-16">
<p>The second argument can now be an empty sequence.</p>
</fos:change>
</fos:changes>
</fos:function>
<fos:function name="analyze-string" prefix="fn">
<fos:signatures>
Expand Down Expand Up @@ -14439,11 +14437,11 @@ filter($input, fn($item, $pos) { $pos gt 1 })
</fos:changes>
</fos:function>

<fos:function name="join" prefix="fn">
<fos:function name="sequence-join" prefix="fn">
<fos:signatures>
<fos:proto name="join" return-type="item()*">
<fos:proto name="sequence-join" return-type="item()*">
<fos:arg name="input" type="item()*" usage="navigation"/>
<fos:arg name="separator" type="item()*" default="()" usage="navigation"/>
<fos:arg name="separator" type="item()*" usage="navigation"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand All @@ -14468,29 +14466,25 @@ for-each($input, fn($item, $pos) {
<fos:examples>
<fos:example>
<fos:test>
<fos:expression>join(1 to 5, "|")</fos:expression>
<fos:expression>sequence-join(1 to 5, "|")</fos:expression>
<fos:result>(1, "|", 2, "|" , 3, "|", 4, "|", 5)</fos:result>
</fos:test>
<fos:test>
<fos:expression>join((), "|")</fos:expression>
<fos:expression>sequence-join((), "|")</fos:expression>
<fos:result>()</fos:result>
</fos:test>
<fos:test>
<fos:expression>join("A", "|")</fos:expression>
<fos:expression>sequence-join("A", "|")</fos:expression>
<fos:result>"A"</fos:result>
</fos:test>
<fos:test>
<fos:expression>join(1 to 5, ())</fos:expression>
<fos:result>(1, 2, 3, 4, 5)</fos:result>
</fos:test>
<fos:test>
<fos:expression>join(1 to 3, ("⅓", "⅔"))</fos:expression>
<fos:expression>sequence-join(1 to 3, ("⅓", "⅔"))</fos:expression>
<fos:result>(1, "⅓", "⅔", 2, "⅓", "⅔", 3)</fos:result>
</fos:test>
</fos:example>
<fos:example>
<p>Insert an empty <code>hr</code> element between adjacent paragraphs:</p>
<eg><![CDATA[join(./para, <hr/>)]]></eg>
<eg><![CDATA[sequence-join(./para, <hr/>)]]></eg>
</fos:example>
</fos:examples>
<fos:changes>
Expand Down
6 changes: 3 additions & 3 deletions specifications/xpath-functions-40/src/xpath-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5517,9 +5517,6 @@ correctly in all browsers, depending on the system configuration.</emph></p>-->
<div3 id="func-items-at" diff="add" at="2022-11-16">
<head><?function fn:items-at?></head>
</div3>
<div3 id="func-join" diff="add" at="A">
<head><?function fn:join?></head>
</div3>
<div3 id="func-remove">
<head><?function fn:remove?></head>
</div3>
Expand All @@ -5529,6 +5526,9 @@ correctly in all browsers, depending on the system configuration.</emph></p>-->
<div3 id="func-reverse">
<head><?function fn:reverse?></head>
</div3>
<div3 id="func-sequence-join" diff="add" at="A">
<head><?function fn:sequence-join?></head>
</div3>
<div3 id="func-slice" diff="add" at="A">
<head><?function fn:slice?></head>
</div3>
Expand Down

0 comments on commit a9c9302

Please sign in to comment.