There is a plugin for Photoshop called SiteGrinder that does spit out valid XHTML and CSS. From what I've seen of it so far though, it's hardly optimal code.. seems to suffer from div-itis for one thing, but what can you expect ?
You want to learn XHTML and CSS, try this book:
http://www.sitepoint.com/books/html1/