Actions
Bug #6260
closed![Author: John Ulric](https://www.gravatar.com/avatar/e071177fac4f4724360eca8039c44cff?rating=PG&size=50&default=https%3A%2F%2Fassets.plan.io%2Fimages%2Fdefault_avatar.png)
![Assignee: Michael Kay](https://www.gravatar.com/avatar/db6526d63053f09b62e52c2da8b2230a?rating=PG&size=22&default=https%3A%2F%2Fassets.plan.io%2Fimages%2Fdefault_avatar.png)
Operator || and fn:concat are not exactly equivalent
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
Actions