Hi,
I added the cleanup code, made use of tidy optional with a command line switch (--use-tidy) fixed some corner cases and made a few other improvements.
So if you are going to try xpml2xhtml.py, please try this version:
http://pastebin.de/3639
Hope this helps,
KevinH