If you invoke a preexisting function that can throw a checked exception, you should write a wrapper function that catches and handles that exception; then, invoke the wrapper method from XSLT instead.
The resulting wrapper function is too long to present inline as a code example, but it seems to work pretty well.