Peter Heneback has a good article “Advanced XML validation” at IBM’s Developerworks site. They have a few worthwhile Ogbuji articles on Schematron too.
Heneback has a somewhat spurious comparison between Schematron and his technique for extending XSLT to generate validation exceptions in Java. Spurious because a Schematron implementation could use his technique; he is comparing apples (Schematron implemented by pipelined transformations of XML) and oranges (extending XSLT). But that is just a wrinkle; his basic idea is really neat and a good contribution to validation implementation techniques.
The trouble with exceptions kind of error handling, or indeed any die-fast Draconian handling, is that very often knowing the rate of an error helps figure out the strategy to fix it. And, especially with path-based constraints, you may not get important diagnostics first: hence Schematron’s support for phases. In my Topologi products, we bring up a list of as many errors as possible for the user to sort and jump to. So possibly it would be better for Heneback’s exception mechanism to be implemented as two parts, first the XSLT extension that adds messages, then finally the exception call. Actually, with that I think all that is needed is a way to handle xsl:message to generate an exception and transfer all the diagnostic messages at the end with a Java exception.

