Sayyiduna Abu Musa al-Ash'ari (may Allah be pleased with him) reports the saying of the Prophet (peace and blessings be upon him): "When a funeral passes by you, whether it is a Muslim, a Christian or a Jew, stand up for it, for we do not stand for it; rather, we stand because of the angels who are with it." Layth says: I narrated this hadith to Mujahid, and he said: Abdullah bin Sakhbarah al-Azdi narrated this hadith to me; he says: Once we were sitting with Sayyiduna Ali (may Allah be pleased with him), waiting for a funeral, when another funeral passed by, so we stood up. Sayyiduna Ali (may Allah be pleased with him) asked: "Why have you stood up?" We said: "This is because of the (hadith) that you have brought to us, O Companions of Muhammad!" Sayyiduna Ali (may Allah be pleased with him) asked: "Which hadith is that?" I said: "Sayyiduna Abu Musa al-Ash'ari (may Allah be pleased with him) stated that the Prophet (peace and blessings be upon him) said: 'When a funeral passes by you, whether of a Muslim, a Jew or a Christian, stand up for it, for we do not stand for it; rather, we stand for the angels who go along with it.'" Sayyiduna Ali (may Allah be pleased with him) said: "The Prophet (peace and blessings be upon him) did this only once, for a Jewish man. He used to resemble the People of the Book (in matters), and when he was forbidden from that, he stopped and did not do it after that."
Allamah al-Haythami says: I say: Al-Nasa'i (may Allah have mercy on him) recorded the hadith of Sayyiduna Ali (may Allah be pleased with him) in abridged form.
Ahmad recorded it. Its chain contains a narrator, Layth bin Abi Sulaym; he is thiqah (trustworthy), but he is a mudallis (one who conceals defects in the chain).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الجنائز / 4115