code: public static String getValueForPath(CmsEntity entity, String path) {
  
          String result = null;
          if (path.startsWith("/")) {
              path = path.substring(1);
          }
          String attributeName;
          if (path.contains("/")) {
              attributeName = path.substring(0, path.indexOf("/"));
              path = path.substring(path.indexOf("/"));
          } else {
              attributeName = path;
              path = null;
          }
          int index = org.opencms.acacia.shared.CmsContentDefinition.extractIndex(attributeName);
          if (index > 0) {
              index--;
          }
          attributeName = entity.getTypeName()
              + "/"
              + org.opencms.acacia.shared.CmsContentDefinition.removeIndex(attributeName);
          CmsEntityAttribute attribute = entity.getAttribute(attributeName);
          if (!((attribute == null) || (attribute.isComplexValue() && (path == null)))) {
              if (attribute.isSimpleValue()) {
                  if ((path == null) && (attribute.getValueCount() > 0)) {
                      List<String> values = attribute.getSimpleValues();
                      result = values.get(index);
                  }
              } else if (attribute.getValueCount() > (index)) {
                  List<CmsEntity> values = attribute.getComplexValues();
                  result = getValueForPath(values.get(index), path);
              }
          }
          return result;
      }
docs: Returns the value for the given XPath expression.<p>
  
  @param entity the entity
  @param path the path
  
  @return the value