Transformer transformer = cachedXSLT.newTransformer();
    private void contractImplHelper(Document _contractImpl) throws Exception,            TransformerFactoryConfigurationError,            TransformerConfigurationException, IllegalArgumentException {        NodeList template = _contractImpl                .getElementsByTagName(CONTRACT_IMPL_ROOT_ELEMENT);        if (template.getLength() == 1) {            Element templateElement = (Element) template.item(0);            String format = templateElement                    .getAttribute(CONTRACT_IMPL_INPUT_FORMAT_ATTRIBUTE);            if ("".equals(format) | format == null) {                throw new DispatcherException(DispatcherException.ERROR_500                        + "\n" + "component: ContractBean" + "\n" + "message:"                        + "\n" + "inputFormat cannot be null");            } else if ("xsl".equals(format)) {                NodeList list_transformer = _contractImpl                        .getElementsByTagName("xsl:stylesheet");                if (list_transformer.getLength() == 1) {                    Node node = list_transformer.item(0);                    TransformerFactory tFactory = TransformerFactory                            .newInstance();                    DOMSource stylesource = new DOMSource(node);                    Transformer transformer = tFactory                            .newTransformer(stylesource);                    if (transformer == null)                        throw new DispatcherException(                                DispatcherException.ERROR_500                                        + "\n"                                        + "component: ContractBean"                                        + "\n"                                        + "message:"                                        + "\n"                                        + "Could not setup transformer in the contractBean."                                        + "\n"                                        + "Please check that the contract implementation is wellformed and valid!"                                        + "\n"                                        + "\n"                                        + "One reason that an implementation may not be valid is that you are using variables that cannot be resolved."                                        + "\n"                                        + "Please see the logs and the sysout for more information, you may are see right away the error.");                    /**                     * Set default properties                     */                    // default forrest properties                    Node defaultVariables = org.apache.forrest.dispatcher.util.SourceUtil                            .readDOM("cocoon://test-props", this.manager);                    transformer.setParameter("defaultVariables",                            defaultVariables);                    transformer.setOutputProperty(                            OutputKeys.OMIT_XML_DECLARATION, "yes");                    transformer.setOutputProperty(OutputKeys.INDENT, "yes");                    transformer.setOutputProperty(OutputKeys.METHOD, "xml");                    this.contractTransformer = transformer;                }            } else {                throw new DispatcherException(DispatcherException.ERROR_404                        + "\n" + "component: ContractBean" + "\n" + "message:"                        + "\n" + "inputFormat=\"" + format                        + "\" not implemented");            }        }        NodeList description = _contractImpl                .getElementsByTagName("description");        if (description.getLength() == 1) {            Element node = (Element) description.item(0);            this.contractDescription = node;        }        NodeList usage = _contractImpl.getElementsByTagName("usage");        if (usage.getLength() == 1) {            Element node = (Element) usage.item(0);            this.contractUsage = node;        }    }