context.pushDocumentContext();
    public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException {        Sequence exceptionClasses = getArgument(0).eval(contextSequence, contextItem);        try {            context.pushDocumentContext();            try {                Sequence result = getArgument(1).eval(contextSequence, contextItem);                return result;            } finally {                context.popDocumentContext();            }        } catch(Exception e) {            context.popDocumentContext();            context.getWatchDog().reset();            for(SequenceIterator i = exceptionClasses.iterate(); i.hasNext(); ) {                Item next = i.nextItem();                try {                    Class exClass = Class.forName(next.getStringValue());                    if(exClass.getName().equals(e.getClass().getName()) || exClass.isInstance(e)) {                        LOG.debug("Calling exception handler to process " + e.getClass().getName(), e);                        UtilModule myModule =                			(UtilModule) context.getModule(UtilModule.NAMESPACE_URI);                        myModule.declareVariable(UtilModule.EXCEPTION_QNAME, new StringValue(e.getClass().getName()));                        myModule.declareVariable(UtilModule.EXCEPTION_MESSAGE_QNAME, new StringValue(e.getMessage()));                        return getArgument(2).eval(contextSequence, contextItem);                    }                } catch (Exception e2) {                    LOG.warn(e2);                }            }            // this type of exception is not caught: throw again            if(e instanceof XPathException)                throw (XPathException)e;            throw new XPathException(e);        }    }