Measurement of the gamma gamma* -> eta and gamma gamma* -> eta ' transition form factors