code: public static String createXpath(String path, int index) {
  
          if (path.indexOf('/') > -1) {
              // this is a complex path over more then 1 node
              StringBuffer result = new StringBuffer(path.length() + 32);
  
              // split the path into sub elements
              List<String> elements = CmsStringUtil.splitAsList(path, '/');
              int end = elements.size() - 1;
              for (int i = 0; i <= end; i++) {
                  // append [i] to path element if required
                  result.append(createXpathElementCheck(elements.get(i), (i == end) ? index : 1));
                  if (i < end) {
                      // append path delimiter if not final path element
                      result.append('/');
                  }
              }
              return result.toString();
          }
  
          // this path has only 1 node, append [index] if required
          return createXpathElementCheck(path, index);
      }
docs: Translates a simple lookup path to the simplified Xpath format used for
  the internal bookmarks.<p>
  
  Examples:<br>
  <code>title</code> becomes <code>title[1]</code><br>
  <code>title[1]</code> is left untouched<br>
  <code>title/subtitle</code> becomes <code>title[1]/subtitle[1]</code><br>
  <code>title/subtitle[1]</code> becomes <code>title[1]/subtitle[1]</code><p>
  
  Note: If the name already has the format <code>title[1]</code> then provided index parameter
  is ignored.<p>
  
  @param path the path to get the simplified Xpath for
  @param index the index to append (if required)
  
  @return the simplified Xpath for the given name