Thanks a lot for sharing your solution :-)
This sounds a lot like these multiple py:match problems that we are
famous for triggering. Basically these are bugs in Genshi and we fixed
some of them in Genshi 0.6 (though this release has new bugs...).
fs