Oli, there are ready and open source converters available like Lynx,
Links, ELinks, W3M etc...
I think that it's not the case to re-write with XSLT what's it's
already done by others with many years of work.
I hoped that PHP had an integrated solution for this, like the engine
of one of the mentioned textual browsers...