$b .= '</p>';
$this->output=$b;
- /// Transform XML file and display it
- $doc = new DOMDocument();
- $xsl = new XSLTProcessor();
-
- $doc->load(dirname(__FILE__).'/xmldb.xsl');
- $xsl->importStyleSheet($doc);
-
- $doc->load($path);
- $this->output.=$xsl->transformToXML($doc);
- $this->output.=$b;
+ if(class_exists('XSLTProcessor')) {
+ /// Transform XML file and display it
+ $doc = new DOMDocument();
+ $xsl = new XSLTProcessor();
+
+ $doc->load(dirname(__FILE__).'/xmldb.xsl');
+ $xsl->importStyleSheet($doc);
+
+ $doc->load($path);
+ $this->output.=$xsl->transformToXML($doc);
+ $this->output.=$b;
+ } else {
+ $this->output.=get_string('extensionrequired','xmldb','xsl');
+ }
/// Launch postaction if exists (leave this unmodified)
if ($this->getPostAction() && $result) {
$string['edit_xml_file'] = 'Edit XML File';
$string['enumvaluesincorrect'] = 'Incorrect values for enum field';
$string['expected'] = 'Expected';
+$string['extensionrequired'] = 'Sorry - the PHP extension \'$a\' is required for this action. Please install the extension if you want to use this feature.';
$string['field'] = 'Field';
$string['fieldnameempty'] = 'Name field empty';
$string['fields'] = 'Fields';