Generalized transitional finite elements and their applications to nonmatching mesh related problems