saxon:on-duplicates

The extension attribute saxon:on-duplicates is available on the xsl:map instruction to define how duplicate keys are to be handled. (From Saxon 11, this is alternatively available with XSLT 4.0 enabled as the synonym on-duplicates, see Controlling duplicates on xsl:map.) The value is an XPath expression that evaluates to a function. If the constructed map has duplicate keys, this function is called to determine how they are to be handled. The function takes two arguments, being two values for the key, and it returns a combined value to be used in the map with that key. For example if the function is function($a, $b) { return max(($a, $b)) } then the value in the final map will be the maximum of the values in the input.

The function can also throw an error, reproducing the default behaviour if no function is specified.