According to the online timetable at
www.travelchinaguide.com, there is a direct train from Datong to Xi'an. It's the Baotao-Xi'an train 1674/1675. Leaves Datong 16:33, arrives 10:40 next day, 1,004 km. Not sure how accurate or up-to-date that site is.
I've confirmed that train number and schedule on a Chinese site:
www.tielu.org
The 1675/1675 is a slower long-distance train, but it has soft seats and soft sleepers, and should still beat going back to Beijing for the "express".
[This message has been edited by rkkwan (edited Mar 18, 2004).]