change in xslt template priority determination behaviour between Saxon 9.5.1 and Saxon 9.6 ?
Added by Eike Michael Meyer over 9 years ago
Hello,
unfortunately I couldn't find any hint on my problem in the change log of Saxon 9.6:
The current version of my application uses Saxon9.5.1.3J for transformation jobs and is running on JDK1.7.0_72. To prepare the step towards JDK1.8 I'll have to switch to Saxon9.6.0.5J (-> Java8 manifest format). During my tests I recognized that the execution of transformations with xsl-templates produced "Recoverable Errors XTRE0540" and the results were not longer correct. The Problem remains running the tests on JDK1.8.0_25.
The execution order of concurrent templates seems to have changed from "most specific" to "last one in template". This suggests that there may be a change in the determination of the default template priority based on the matching xpath expression.
I know one solution could be to assign explicit priority values to each rule but that would be a really time consuming Job considering the bunch of templates my application is handling...
Can anyone tell me whether the behaviour described above is a bug or an intended change? Can I do anything (implementation, parameterization, configuration) to cope with this problem apart from reviewing and re-writing our complete (partly generated) rule portfolio?
Below you see one simple template which works really well with Saxon9.5.1.3J while with Saxon9.6.0.5J it produces the shown warning and generates results that show the wrong "last one in template" execution:
Recoverable error XTRE0540: Ambiguous rule match for /Document Matches both "*[namespace-uri()=$nsUriOld]" on line 23 of and "/*[namespace-uri()=$nsUriOld]" on line 8 of
If I'd need to provide any further Information please ask.
If anyone can lead me out of this unlucky situation, thanks in advance!
Regards eike2k
Replies (3)
Please register to reply
RE: change in xslt template priority determination behaviour between Saxon 9.5.1 and Saxon 9.6 ? - Added by Michael Kay over 9 years ago
There's no difference in precedence or priority between these two template rules. Your notion of "most specific" doesn't come into it: there's no concept in the spec or in Saxon that one of these rules is more specific than the other. They have the same default priority. Using the last rule in document order is therefore the correct behaviour. I'm surprised that a previous release should have behaved differently, but I'll check it and see.
If you want the first template rule to be chosen in cases where both match, the right thing to do is to give both rules an explicit priority.
RE: change in xslt template priority determination behaviour between Saxon 9.5.1 and Saxon 9.6 ? - Added by Michael Kay over 9 years ago
OK, interesting: Saxon 9.5.1.3 gets it wrong (it executes the first template rule). But it was fiexd by 9.5.1.6.
That pins it down to this bug here, fixed in 9.5.1.4:
RE: change in xslt template priority determination behaviour between Saxon 9.5.1 and Saxon 9.6 ? - Added by Eike Michael Meyer over 9 years ago
ok, clarifies the Problem...
thank you very much!
Please register to reply