What you propose does not seem to be impossible, and it's quite impressive. But are there any guys here who are willing to join in such a development?
Good question, may be should send a note to other doc-teams around the world, to get a critical mass of developers for such a project.
Well, what came into my mind is that Damien Seguy already has similar code to render the DocBook tags we use into HTML. Though it is not designed to work on the fly, we may be able to use the code here.
Read Online:
http://dev.nexen.net/docs/php/annotee/
Download: http://dev.nexen.net/docs/php/index.php
I don't remember what he uses for PDF generartion, but those PDFs are not that bad either ;)
Goba