From 94c73ff625d2d420b69d5f4b51283ce9c7d6f0c8 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Wed, 23 May 2012 10:11:54 -0300 Subject: [PATCH] Suppress warnings for XSLTs that do not exist for Object Details tab. --- ObjectDetails.inc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ObjectDetails.inc b/ObjectDetails.inc index 5da6a063..96349868 100644 --- a/ObjectDetails.inc +++ b/ObjectDetails.inc @@ -61,18 +61,23 @@ function fedora_repository_object_details_XSLT($item) { $proc->setParameter('', 'baseUrl', $base_url); $proc->setParameter('', 'path', $base_url . '/' . $path); $input = NULL; - $xsl = new DomDocument(); - try { - $xsl->load('./'. $path .'/'. variable_get('islandora_object_details_xslt_sheet', 'xsl/convertQDC.xsl')); - $input = new DomDocument(); + + $xsl_file = './'. $path .'/'. variable_get('islandora_object_details_xslt_sheet', 'xsl/convertQDC.xsl'); + if (is_readable($xsl_file)) { + $xsl = new DOMDocument(); + $xsl->load($xsl_file); + $input = new DOMDocument(); $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(); + return $output; + } + else { + watchdog('fedora_repository', 'The XSLT file @xslt_name is not readable.', array( + '@xslt_name' => $xsl_file, + )); } - $xsl = $proc->importStylesheet($xsl); - $newdom = $proc->transformToDoc($input); - $output = $newdom->saveHTML(); - return $output; } function fedora_repository_object_details_table($item) {