if (m_doc != null) {
// Check that the context node is owned by the same document
if ((contextNode != m_doc) && (!contextNode.getOwnerDocument().equals(m_doc))) {
String fmsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_DOCUMENT, null);
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, fmsg);
}
// Check that the context node is an acceptable node type
short nodeType = contextNode.getNodeType();
if ((nodeType != Document.DOCUMENT_NODE) &&
(nodeType != Document.ELEMENT_NODE) &&
(nodeType != Document.ATTRIBUTE_NODE) &&
(nodeType != Document.TEXT_NODE) &&
(nodeType != Document.CDATA_SECTION_NODE) &&
(nodeType != Document.COMMENT_NODE) &&
(nodeType != Document.PROCESSING_INSTRUCTION_NODE) &&
(nodeType != XPathNamespace.XPATH_NAMESPACE_NODE)) {
String fmsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_NODETYPE, null);
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, fmsg);
}
}
//
// If the type is not a supported type, throw an exception and be