I've had this problem before with incorrect drivers (not updating from win98 to winxp drivers after upgrade) and devices compatible with win98 and not winxp.
Usb devices connected to the computer during shutdown. Try removing one at a time and try shutting down if it shuts down correctly try updating the drivers for that device or check to see if it is compatible with winxp at all.
Some other causes at the link below
http://aumha.org/win5/a/shtdwnxp.php