I created a test case next-match-039 which uses a match pattern match="one[XXX] | one[YYY]"
where the same input element matches both predicates. So both branches of the pattern match, and both have the same priority. The body of the template uses xsl:next-match, but the rule is only firing once.
The spec says: As explained in 6.4 Conflict Resolution for Template Rules, a template rule with no priority attribute, whose match pattern contains multiple alternatives separated by |, is treated equivalently to a set of template rules, one for each alternative. This means that where the same item matches more than one alternative, it is possible for an xsl:next-match instruction to cause the current template rule to be invoked recursively.
The reference in this text is incorrect: it should point to ยง6.5 (clause 2), which states:
If the top-level pattern is a UnionExprP consisting of multiple alternatives separated by | or union, then the template rule is treated equivalently to a set of template rules, one for each alternative. These template rules are adjacent to each other in declaration order, and the declaration order within this set of template rules (which affects the result of xsl:next-match if the alternatives have the same default priority) is the order of alternatives in the UnionExprP.
So I think we should definitely be invoking the template rule twice. The reason we aren't is that both rules (branches) have the same value for the sequence
property, and the reason for this is so that we can suppress the warning when we get an ambiguous match on two branches of the union pattern.
The rules for warning-on-multiple-match
can be read as requiring a warning in this case, or at any rate permitting it. However, warnings are always discretionary and it seems unfriendly to produce a warning in this case; certainly many users would regard it as a regression.