"does anyone know the route for the slow train from Madrid to Barcelona" - no need to take any slow trains, the AVE train between Madrid and Barcelona, as Scythian mentioned above, stops at the worthwhile city of Zaragoza.
Zaragoza is the capital of the region of Aragon and worth at least a few nights. The city has more than 2,000 years of history including Roman ruins of the city walls, forum, and amphitheater, as well as the Aljafería; an 11th-century Moorish palace. It's also the home of the famous pilgrimage site of Nuestra Señora del Pilar Basilica, housing the miraculous image of the Virgin Mary of Pilar. The best part, Zaragoza is relatively undiscovered as far as major Spanish cities go.
Zaragoza also has some pretty good day trips close by, like the Royal Palace of Olite, one of the most impressive medieval palaces in Europe. It was the seat of the Kings of Navarre. Another interesting day trip is Loarre Castle, one of the oldest castles in Spain, it was featured in Ridley Scott's epic film Kingdom of Heaven. The Loarre Castle is very picturesque as it sits high on a cliff overlooking the southern foothills of the Pyrenees.
Closer to Barcelona, I think that the AVE also stops at the seaside town of Tarragona. Tarragona has some of the better Roman ruins in Spain, including a Roman amphitheater, Praetorium tower, and intact aqueduct, which are jointly designated as World Heritage Sites by UNESCO. They also have a great Roman history museum called Museu Nacional Arqueològic (MNAT), showcasing various treasures from antiquity. The twisting medieval center of Tarragona also makes for a nice place for walks and dining.
From Tarragona, one can do a day trip to the Poblet Royal Monastery - also a UNESCO World Heritage Site and still active 12th-century Cistercian monastery. It was a fortified medieval royal residence and now contains the unique hanging tombs of the old Kings of Aragon.