code: public static String removeXpathIndex(String path) {
  
          int pos1 = path.lastIndexOf('/');
          int pos2 = path.lastIndexOf('[');
          if ((pos2 < 0) || (pos1 > pos2)) {
              return path;
          }
  
          return path.substring(0, pos2);
      }
docs: Removes the last Xpath index from the given path.<p>
  
  Examples:<br>
  <code>title</code> is left untouched<br>
  <code>title[1]</code> becomes <code>title</code><br>
  <code>title/subtitle</code> is left untouched<br>
  <code>title[1]/subtitle[1]</code> becomes <code>title[1]/subtitle</code><p>
  
  @param path the path to remove the Xpath index from
  
  @return the path with the last Xpath index removed