Document xsl = readFile(href, path);
if (xsl == null)
throw new FileNotFoundException(href);
QElement top = (QElement) xsl.getDocumentElement();
if (top == null ||
! "stylesheet".equals(getXslLocal(top)) &&
! "transform".equals(getXslLocal(top))) {
throw error("imported stylesheet `" + href +
"' missing xsl:stylesheet.");
}
int oldMinImportance = _minImportance;
Path oldContext = _context;
Path virtualPath = _context.getParent().lookup(href);
_context = virtualPath;
_minImportance = _importance;
boolean oldTop = _isTop;
boolean oldRaw = _isRawText;
_isTop = false;
_isRawText = false;
String systemId = top.getBaseURI();
if (systemId != null)
_context = _context.lookup(systemId);
XslStylesheet stylesheet = (XslStylesheet) createChild(top);