xpathExpressionContext = ((Document) contextNode).getDocumentElement();
}
else {
xpathExpressionContext = contextNode;
}
final PrefixResolver prefixResolver = new HtmlUnitPrefixResolver(xpathExpressionContext);
final boolean caseSensitive = contextNode.getPage().hasCaseSensitiveTagNames();
final XPathAdapter xpath = new XPathAdapter(str, null, prefixResolver, null, caseSensitive);
final int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
}