Project

Profile

Help

Bug #6260

closed

Operator || and fn:concat are not exactly equivalent

Added by John Ulric about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2023-11-22
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

Probably not the most urgent problem admittedly ;-) but I've been trying to wrap my head around XPath Atomization § 2.4.2 and Function Conversion Rules § 3.1.5.2 in more detail and was wondering about the following effect with fn:concat and the string concatenation operator ||.

§ 3.6 says: In XPath 3.1, $a || $b is equivalent to fn:concat($a, $b).

With Saxon HE 12.3, || and fn:concat do not seem to be exactly equivalent:

let $a:=(1,2), $b:=(3,4) return concat($a, $b)
→ XPTY0004  The first argument of concat() does not satisfy the cardinality constraints
let $a := (1,2), $b:=(3,4) return $a || $b
→ 1234

Is this maybe an artifact of fn:concat being the only varargs function? Or is there a part of the spec that I'm missing? Or is it a missing detail in the spec? Or a Saxon issue?

fn:string-join, eg, behaves as I would have expected:

let $a:=(1,2,3) return string-join($a, "-")
→ 1-2-3
let $a:=[1,2,3] return string-join($a, "-")
→ 1-2-3

Thanks, John

Please register to edit this issue

Also available in: Atom PDF