Re the original question of how best to report errors from an extension function: As of the most recent versions of Xalan, It's possible to extract the XPathContext object from the ExpressionContext object (optional first argument to an extension function). In older versions of Xalan, that required a bit of magic:
XPathContext xctxt = ((XPathContext.XPathExpressionContext)expressionContext).getXPathContext();
I believe newer versions may support the getXPathContext() method directly on ExpressionContext.
Once you have the XPathContext, you can use its getErrorListener() method to retrieve the TRaX ErrorListener object which this transformation is sending its error messages to, and then call the ErrorListener's methods to report warnings, errors, and fatal errors as appropriate.
______________________________________
Joe Kesselman / IBM Research
