protected function schematronValidate(DOMDocument $document, $filename)
{
$stylesheet = $this->loadFile($filename);
$xsltProcessor = new XSLTProcessor();
$xsltProcessor->importStyleSheet($stylesheet);
$result = $xsltProcessor->transformToDoc($document);
$xpath = new DOMXPath($result);
$xpath->registerNamespace('svrl', 'http://purl.oclc.org/dsdl/svrl');
$xpathExpression = '//svrl:failed-assert';
$failures = array();
$failedAsserts = $xpath->query($xpathExpression);
foreach ($failedAsserts as $failedAssert) {
$failures[] = $this->formatSVRLFailure($failedAssert);
}
return $failures;
}