Added findAncestorByAttribute method.