if (!(styleDoc.getDocumentElement() instanceof XSLStylesheet)) {
throw new TransformerConfigurationException(
"Outermost element of stylesheet is not xsl:stylesheet or xsl:transform or literal result element");
}
XSLStylesheet top = (XSLStylesheet)styleDoc.getDocumentElement();
// Preprocess the stylesheet, performing validation and preparing template definitions
top.setPreparedStylesheet(this);
top.preprocess();
// Compile the stylesheet, retaining the resulting executable
executable = top.compileStylesheet();
}