Just checked out your source code. You're pretty much just transforming XML 1:1 into another markup language. You could, if you wanted, just make an XSL sheet to do the work and use PHP to apply the stylesheet to the source, present the output.
Might be a fun exercise. I've done a fair amount of XSL(T) going from XML into XML:FO to create PDF reports. Forces you to think about stuff in a different manner.
Heh, I see CNYCacher just said the same thing.