Closed xml-project closed 4 years ago
Hmm, in XSLT’s for-each-group/@group-adjacent
the expression must result in exactly one atomic value (for @group-by
, there can be multiple result values), and these atomic values are compared using deep-equal.
Do we also require that the group-adjacent
expressions, after atomization, yield exactly one atomic value? If we have only a single value, equal
and deep-equal
are the same.
The spec says “Whenever two or more sequentially adjacent documents have the same “group adjacent” value, …”
This might imply that we expect our group-adjacent
expression to also return exactly one value.
If we permit sequences as expression results, we should nevertheless say that they be atomized. And then they should be compared using deep-equal()
.
If we permit sequences as expression results, we should nevertheless say that they be atomized.
Why? Doesn't that exclude maps, functions and arrays as values because they can not be atomized?
What plausible use case for wrapping a sequence requires a map, array, or function as a group-adjacent value?
What reasons to exclude them?
I don't feel strongly about it. I'm happy to say deep-equal is the answer, consistent with XSLT. I'd be equally happy to say that exactly one value must be returned, but I don't feel strongly about that either.
(Achim, you seem to have written the ab-wrap-sequence-014
test such that it's not a deep-equal comparison; so I wonder if we've both changed our minds! 😄 )
I don’t have a strong opinion either. There may be a slight benefit in aligning with XSLT, in order to reduce the mental strain on XSLT/XProc programmers.
If one method was easier to implement for an XProc processor, this would also make a case for it. But since deep-equal()
on any kind of XDM 3.1 items is available to each implementation, this shouldn’t be a criterion.
Here's an observation: if we use deep-equal()
and you happen to want an atomic comparison, you can atomize. If we use eq
or =
and you want a deep-equal()
comparision, you're out of luck.
I think that persuades me that we should use deep-equal()
.
Currently we say:
As @ndw and I found out, the concept of having "the same group adjacent value" is ambiguous because it could either mean that the two values are equal or that they are deep-equal.
Remember there are differences between the two concepts as "() = ()" is false(), but "deep-equal((),())" is true. Furthermore " = " is true(), but "deep-equal(, ) is false().
Any opinion which concept of "same value" we want here?