If two adjacent links of a flexible robot are connected via a revolute joint or a fixed prismatic joint, the relative motion of the next link will depend on both the joint motion and the elastic displacement of the distal end of the previous link. However, if the two adjacent links are connected via a sliding prismatic joint, the relative motion of the next link will depend additionally on the elastic deformation distributed along the previous link. Therefore, formulation of the motion equations for a multi-link flexible robot consisting of the revolute joints, the fixed prismatic joints and the sliding prismatic joints is challenging. In this study, the finite element kinematic and dynamic formulation was successfully developed and validated for the flexible robot, in which a transformation matrix is proposed to describe the kinematics of both the joint motion and the link deformation. Additionally, a new recursive formulation of the dynamic equations is introduced. As compared with the previous methods, the time complexity of the formulation is reduced by O(2η), where η is the number of finite elements on all links. The numerical examples and experiments were implemented to validate the proposed kinematic and dynamic modelling method.