Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

1725 Define more detailed rules for duplicates in maps #1727

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

michaelhkay
Copy link
Contributor

@michaelhkay michaelhkay commented Jan 23, 2025

Clarifies the rules for how duplicates are handled by map:merge, map:build, map:of-pairs, and xsl:map.

Introduces a callback option for map:merge that is compatible with map:build and map:of-pairs, to increase commonality between all four functions/instructions.

Fix #1725

@michaelhkay michaelhkay changed the title 1726 Define more detailed rules for duplicates in maps 1725 Define more detailed rules for duplicates in maps Jan 23, 2025
@michaelhkay michaelhkay added XSLT An issue related to XSLT XQFO An issue related to Functions and Operators Enhancement A change or improvement to an existing feature Tests Needed Tests need to be written or merged labels Jan 23, 2025
successively to pairs of duplicates. The position in the <xtermref spec="DM40" ref="dt-entry-order"/>
of the result map of an entry formed by combining duplicates corresponds to the
position of the first occurrence of the key in the input sequence. This is true
even whien the option <code>use-last</code> is used: the value of the resulting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
even whien the option <code>use-last</code> is used: the value of the resulting
even when the option <code>use-last</code> is used: the value of the resulting

Copy link
Contributor

@ChristianGruen ChristianGruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It is nice to have combine for map:merge. Maybe we should be fully consistent and also add the duplicates option to map:build.
  • “The key of the combined entry is one of the duplicate keys” → Could we let it always be the first key (as order matters), or is it backward-compatibility that prevents us from doing so?
  • fn:random-number-generator()...: maybe better one-of.

@ndw
Copy link
Contributor

ndw commented Jan 28, 2025

At meeting 107, the CG agreed to accept this PR.

@ndw ndw merged commit 5875557 into qt4cg:master Jan 28, 2025
9 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Enhancement A change or improvement to an existing feature Tests Needed Tests need to be written or merged XQFO An issue related to Functions and Operators XSLT An issue related to XSLT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Position of duplicates in ordered maps
3 participants