Does the mesoderm evolve from the ectoderm or the endoderm?
In human,the mesoderm doesnot develop from the endoderm or the ectoderm.It develops from epiblast of the bilaminar germ disc stage.

During the week 3 of development, the epiblast of the disc invaginate and divide rapidly to form the cells of the endoderm.The division is rapid enough to replace the hypoblast layer.

Even after the endodermal layer has formed, the epiblast continues to divide at the region of the invagination.The divided cells migrate between the epiblast(soon to be the future ectoderm) and the newly formed endoderm to form the mesoderm.

REFERENCES: 


Langman's Medical Embryology (13th edition) T.W. Sadler
website