Well, I don't pretend to be an expert on this. 'just someone who did something similar and made it work. For what it is worth.........
If you can determine the total list of possible XML tags and structures, then you can decide how you want to convert them to HTML. Write a series of replacements for each item you want converted. The is some brute force involved here, but, the Perl regex engine is pretty quick. For instance, our internally created XML docs had table structures which I converted with this.
#-- code --#
sub convertTable
{
$buffer =~ s/<html:thead>//gis; [red]# did not need this - replace with null[/red]
$buffer =~ s/<html:tbody>/<table>/gis; [red]# start/end table tags[/red]
$buffer =~ s/<\/html:tbody>/<\/table>/gis;
$buffer =~ s/<html:th>/<th>/gis; [red]# table header[/red]
$buffer =~ s/<\/html:th>/<\/th>/gis;
$buffer =~ s/<html:tr>/<tr>/gis; [red]# table row[/red]
$buffer =~ s/<\/html:tr>/<\/tr>/gis;
$buffer =~ s/<html:td>/<td>/gis; [red]# table definition[/red]
$buffer =~ s/<\/html:td>/<\/td>/gis;
}
#-- end code --#
I read the entire file into $buffer and called that sub which made the XML to HTML replacements globally. This is just one of about 20 subs which did other conversions in a similar manner. I realize this looks like a lot of regex's, but, it runs reasonably quickly on files up to several hundred k.
If you can't get a list of the possible conversions you may have to do, then I guess you will need to parse the DTD to get translations and work from there. I was lucky. We did not need to validate the XML and I had a limited universe of tags to deal with. I hope you are equally lucky.
'Good Luck...
keep the rudder amid ship and beware the odd typo