Useful scripts developed and used for this diploma thesis:

php routines for reading flat xml files
main document for diplomathesis
php routines for parsing the diplomathesis
main document for displaying diplomathesis
document for displaying table of contents
document for displaying other lists
Word macro for converting html to correct formatted text

The diploma thesis in XML format

I recommend to look at DocBook because this is a standard.