Browse Source

configured better error detection around a missing xslt file

pull/127/head
Jason MacWilliams 13 years ago
parent
commit
8428eb2393
  1. 25
      ObjectDetails.inc

25
ObjectDetails.inc

@ -87,17 +87,24 @@ function fedora_repository_object_details_XSLT($item) {
$proc->setParameter('', 'baseUrl', $base_url); $proc->setParameter('', 'baseUrl', $base_url);
$proc->setParameter('', 'path', $base_url . '/' . $path); $proc->setParameter('', 'path', $base_url . '/' . $path);
$input = NULL; $input = NULL;
$xsl = new DomDocument();
try { $xsl_file = './'. $path .'/'. variable_get('islandora_object_details_xslt_sheet', 'object_details_xslts/convertQDC.xsl');
$xsl->load('./'. $path .'/'. variable_get('islandora_object_details_xslt_sheet', 'object_details_xslts/convertQDC.xsl')); // set an error message in case xslt parsing fails
$output = t("Failed to parse xslt file at @xsltFile", array('@xsltFile' => $xsl_file));
if (is_readable($xsl_file)) {
$xsl = new DomDocument();
$input = new DomDocument(); $input = new DomDocument();
$input->loadXML(trim($xmlstr)); try {
} catch (Exception $e) { $xsl->load($xsl_file);
watchdog('fedora_repository', "Problem loading XSL file: @e", array('@e' => $e->getMessage()), NULL, WATCHDOG_ERROR);
$input->loadXML(trim($xmlstr));
} catch (Exception $e) {
watchdog('fedora_repository', "Problem loading XSL file: @e", array('@e' => $e->getMessage()), NULL, WATCHDOG_ERROR);
}
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$output = $newdom->saveHTML();
} }
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$output = $newdom->saveHTML();
return $output; return $output;
} }

Loading…
Cancel
Save