When trying to convert some code using template matching to a package and using that package Saxon (Saxon-EE 9.7.0.15J) started to emit @XTDE0540: Ambiguous rule match@ warnings that it doesn't emit when the same templates are simply used or imported.
I have tried to reduce that to a minimal case, here is the warning
Warning
XTDE0540: Ambiguous rule match for /element
Matches both "element(Q{}element)[(data(attribute::attribute(Q{}name))) = "foo"]" on line
31 of file:/SomePath/test-package1.xsl
and "element(Q{}element)" on line 25 of
file:/SomePath/test-package1.xsl
I get for that reduced test case.
The test case package is
When I run solely the package (with @-im:m2@) against an input like
I don't get any warnings about ambiguous rules, however, when using the package in
against an input
I get the warning cited at the beginning of the post.
Why are the templates being assessed as having the same priority in the case of @xsl:use-package@ but not when running the package code directly?