code: int getPreviouslyCounted(XPathContext support, int node)
    {
  
      int n = m_countNodes.size();
  
      m_countResult = 0;
  
      for (int i = n - 1; i >= 0; i--)
      {
        int countedNode = m_countNodes.elementAt(i);
  
        if (node == countedNode)
        {
  
          // Since the list is in backwards order, the count is 
          // how many are in the rest of the list.
          m_countResult = i + 1 + m_countNodesStartCount;
  
          break;
        }
        
        DTM dtm = support.getDTM(countedNode);
  
        // Try to see if the given node falls after the counted node...
        // if it does, don't keep searching backwards.
        if (dtm.isNodeAfter(countedNode, node))
          break;
      }
  
      return m_countResult;
    }
docs: Try and find a node that was previously counted. If found,
  return a positive integer that corresponds to the count.
  
  @param support The XPath context to use
  @param node The node to be counted.
  
  @return The count of the node, or -1 if not found.