Sefer Chasidim: Escorting the Dead 2
Reuven hated Shimon. When he heard that Shimon had passed away, he said, “I don’t want to go to his funeral and escort him to the cemetery.” Hearing these harsh words, an old man said, “It will be an honor for the deceased if you attend his funeral. Animosity and hatred should not deter a person from joining his enemy’s funeral procession.” However, if a dying person said, “Don’t allow so-and-so to participate in the preparations ffor burial,” he should not take part in the funeral. (Sefer Chasidim #537 – Translated by Avraham Yaakov Finkel
This is based on the Talmud – Sanhedrin 19a The Meiri explains that whenever there is a possibility that the person suffering will believe that the other is rejoicing at his misery, he should stay away.
Beit Hillel (Y’D #362) rules that the enemy may attend only if his participation may lead to repairing the relationship with the deceased’s family.