code: public String generateUniqueId(String prefix, String text)
      {
          // Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.
          if (StringUtils.isEmpty(prefix) || !StringUtils.isAlpha(prefix)) {
              throw new IllegalArgumentException(
                  "The prefix [" + prefix + "] should only contain alphanumerical characters and not be empty.");
          }
  
          String idPrefix = prefix + normalizeId(text);
  
          int occurence = 0;
          String id = idPrefix;
          while (this.generatedIds.contains(id)) {
              occurence++;
              id = idPrefix + "-" + occurence;
          }
  
          // Save the generated id so that the next call to this method will not generate the same id.
          this.generatedIds.add(id);
  
          return id;
      }
docs: Generate a unique id attribute using the passed text as the seed value. The generated id complies with the XHTML
  specification. Extract from <a href="http://www.w3.org/TR/xhtml1/#C_8">XHTML RFC</a>:
  <p>
  <code> When defining fragment identifiers to be backward-compatible, only strings matching the pattern
  [A-Za-z][A-Za-z0-9:_.-]* should be used.</code>
  </p>
  
  @param prefix the prefix of the identifier. Has to match [a-zA-Z].
  @param text the text used to generate the unique id
  @return the unique id. For example "Hello world" will generate prefix + "Helloworld".