Walking at a Funeral and Prayer over the Dead - Section 1 Mishkat al-Masabih 1648
Arabic hadith text
وَعَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِذَا رَأَيْتُمُ الْجَنَازَةَ فَقُومُوا فَمَنْ تَبِعَهَا فَلَا يَقْعُدْ حَتَّى تُوضَعَ»
Translation
He reported God’s messenger as saying, “When you see a funeral stand up; but anyone who follows it must not sit down till the bier is placed on the ground.” (Bukhari and Muslim.)