public List selectNodes(Object node)
{
try
{
DOMSource rootNode = new DOMSource((Node) node);
XPathEvaluator xpe = new XPathEvaluator();
Configuration c = new Configuration();
c.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
XBeansIndependentContext sc = new XBeansIndependentContext(c);
// Declare ns bindings
if (defaultNS != null)
sc.setDefaultElementNamespace(defaultNS);
for (int i = 0; i < namespaceMap.length; i++)
{
Map.Entry entry = (Map.Entry) namespaceMap[i];
sc.declareNamespace((String) entry.getKey(),
(String) entry.getValue());
}
xpe.setStaticContext(sc);
Variable thisVar = sc.declareVariable(_contextVar);
thisVar.setValue(needsDomSourceWrapping ? rootNode : node);
XPathExpression exp = xpe.createExpression(_queryExpr);
// After 8.3(?) Saxon nodes no longer implement Dom.
// The client needs saxon8-dom.jar, and the code needs
// this NodeOverNodeInfo Dom wrapper doohickey
List saxonNodes = exp.evaluate(rootNode);