docs: function eval_xpath(xpath, inDocument, opts)
  {
      if (! opts) {
          var opts = {};
      }
  
      var contextNode = opts.contextNode
          ? opts.contextNode : inDocument;
      var namespaceResolver = opts.namespaceResolver
          ? opts.namespaceResolver : null;
      var xpathLibrary = opts.xpathLibrary
          ? opts.xpathLibrary : null;
      var allowNativeXpath = (opts.allowNativeXpath != undefined)
          ? opts.allowNativeXpath : true;
      var ignoreAttributesWithoutValue = (opts.ignoreAttributesWithoutValue != undefined)
          ? opts.ignoreAttributesWithoutValue : true;
      var returnOnFirstMatch = (opts.returnOnFirstMatch != undefined)
          ? opts.returnOnFirstMatch : false;
  
      if (! eval_xpath.xpathEvaluator) {
          eval_xpath.xpathEvaluator = new XPathEvaluator();
      }
  
      var xpathEvaluator = eval_xpath.xpathEvaluator;
  
      xpathEvaluator.setCurrentEngine(xpathLibrary);
      xpathEvaluator.setAllowNativeXPath(allowNativeXpath);
      xpathEvaluator.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue);
  
      if (returnOnFirstMatch) {
          var singleNode = xpathEvaluator.selectSingleNode(inDocument, xpath,
              contextNode, namespaceResolver);
  
          var results = (singleNode ? [ singleNode ] : []);
      }
      else {
          var results = xpathEvaluator.selectNodes(inDocument, xpath, contextNode,
              namespaceResolver);
      }
  
      return results;
  }