code: public int compareTo(Object o) throws ClassCastException {
      
      ElemTemplateElement ro = (ElemTemplateElement) o;
      int roPrecedence = ro.getStylesheetComposed().getImportCountComposed();
      int myPrecedence = this.getStylesheetComposed().getImportCountComposed();
  
      if (myPrecedence < roPrecedence)
        return -1;
      else if (myPrecedence > roPrecedence)
        return 1;
      else
        return this.getUid() - ro.getUid();
    }
docs: Compares this object with the specified object for precedence order.
  The order is determined by the getImportCountComposed() of the containing
  composed stylesheet and the getUid() of this element.
  Returns a negative integer, zero, or a positive integer as this
  object is less than, equal to, or greater than the specified object.
  
  @param o The object to be compared to this object
  @return  a negative integer, zero, or a positive integer as this object is
  less than, equal to, or greater than the specified object.
  @throws ClassCastException if the specified object's
  type prevents it from being compared to this Object.