Jabir ibn `Abdullah is reported to have said, “A funeral procession passed by us and so the Prophet (Allah bless him and grant him peace) stood up for it and we stood because of him. We said, ‘Oh Messenger of Allah, it is the funeral procession of a Jew.’ He said, ‘When you see a funeral procession, stand.” [Bukhari] In Muslim it is narrated with the additional wording, “Indeed, death is alarmingly frightful so if you see a funeral procession, stand.” In another narration the Prophet (Allah bless him and grant him peace) said, “Is he not a soul?” [Bukhari, Muslim]
Anas ibn Malik narrated other reasons why standing at the sight of funeral procession was generally performed stating, “We only stood for the angels” [Hakim, Mustadrak] whereas `Abdullah ibn `Amr narrated, “You only stood out of reverence for the one who takes all souls.” [Ahmad, Musnad; Hakim, Mustadrak; Ibn Hibban, Sahih] Ibn Hajar `Asqalani mentions that all of the above return to the initial reasoning mentioned, namely out of alarm and fear of death. [Fath al-Bari]
As for the narration of `Ali ibn Abi Talib, it is narrated with the words, “The Prophet (Allah bless him and grant him peace) stood (s: for the funeral prayer) then he sat.” [Muslim, Tirmidhi] Another version states, “He commanded us to stand for the funeral procession then he sat after that and commanded us to sit.” [Ibn Hibban, Sahih]
The scholars differed regarding whether the narration of `Ali ibn Abi Talib abrogated the previous command of standing or not. Qadi iyyad said: “People differed on this issue. Malik, Shafi`i, and Abu Hanifa said that the standing was abrogated. Ahmad, Ishaq, Ibn Habib, and Ibn Majishawn – [the latter] two Malikis – said that one has a choice (s: of standing or remaining seated).” [Nawawi, Sharh Sahih al-Muslim]
Imam Nawawi, explaining the Shafi`i position, said, “The well known position in our school is that standing is not recommended. They said, ‘It was abrogated by the narration of `Ali.’ Mutawalli, from our companions, chose that it was recommended. This is the preferred position, and so the command to stand for it is for recommendation and sitting is in order to clarify the permissibility [of sitting].” [ibid] He stated elsewhere, “The narrations commanding standing have been authenticated, and nothing has been established concerning sitting except the narration of `Ali, which is not clear in its abrogation.” [Nawawi, Sharh al-Muhadhab]
As for the Hanafi position, then one does not stand up for a funeral possession that is passing by, except in order to walk behind the procession. [Halabi, Halabi Kabir; `Ala al-Din ibn `Abidin, Hadiyyah al-Ala’iyyah]
In the end, the matter is differed upon and therefore one should not make it a matter of contention.