A unified framework for establishing the universal approximation of transformer-type architectures