I have some XML that looks like this:
Here's one way you could do it, by calling into a PHP function from XSLT:
function parseHTMLString($html)
{
$doc = new DOMDocument();
$doc->loadHTML($html);
return $doc;
}
$xml = <<
EOB;
$xsl = <<
EOB;
$xmldoc = new DOMDocument();
$xmldoc->loadXML($xml);
$xsldoc = new DOMDocument();
$xsldoc->loadXML($xsl);
$proc = new XSLTProcessor();
$proc->registerPHPFunctions('parseHTMLString');
$proc->importStyleSheet($xsldoc);
echo $proc->transformToXML($xmldoc);