private static int getNumberSimple(DTM dtm, int node) {
    final String localName = dtm.getLocalName(node);

    String uri = dtm.getNamespaceURI(node);
    if (uri == null) uri = "";

    final short type = dtm.getNodeType(node);

    int i = 1;
    int p = node;
    while ((p = dtm.getPreviousSibling(p)) != DTM.NULL) {
      if (dtm.getNodeType(p) == type) {
        switch (type) {
          case Node.TEXT_NODE:
          case Node.COMMENT_NODE:
          case Node.PROCESSING_INSTRUCTION_NODE:
            i++;
            break;
          default:
            if (localName.equals(dtm.getLocalName(p)) && uri.equals(dtm.getNamespaceURI(p))) {
              i++;
            }
        }
      }
    }
    return i;
  }
private static int getNumberSimple(DTM dtm, int node)