Perhaps this kind of extra tagging s/b done beforehand instead ? You add the `epub:type` based on the HTML 4 / XHTML then convert to HTML5 which keeps the `epub:type`.