Depending on specifically what it is you're doing, you might be able to use an XSD to validate your input prior to applying an XSLT to it, and having the XSD report errors as validation errors.
Or, alternatively you could design a 'pre-process' XSLT that identifies and outputs errors rather than the output you're looking for, and run that first. You could probably doing that by removing any output from your existing XSLT, and substituting <xsl:message>
with <xsl:text>
. To be honest though, that seems a bit of a 'hacky' way of doing it.
Or a final possibility is simply defining and outputting an <error>
element in your output, and doing a quick check for the presence of any such elements in your output, using a simple XPath query (//error
for example).