[?1034hdiff -r 92014bbda96f machine-fs/srv/drupal/sites/all/modules/xmlcontent/xmlcontent.module --- a/machine-fs/srv/drupal/sites/all/modules/xmlcontent/xmlcontent.module Sun Sep 02 14:28:50 2007 -0400 +++ b/machine-fs/srv/drupal/sites/all/modules/xmlcontent/xmlcontent.module Sun Sep 02 15:21:42 2007 -0400 @@ -40,6 +40,8 @@ function xmlcontent_filter($op, $delta = case 'process': $xslt_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_xslt_path_$format", ''); + if (!is_file($xslt_path)) + $xslt_path = variable_get("xmlcontent_xslt_path_$format", ''); return _xmlcontent_transform($text, $xslt_path); case 'settings': @@ -160,8 +162,8 @@ function _xmlcontent_filter_settings($fo '#type' => 'textfield', '#title' => t('XSLT Script File Path'), '#default_value' => variable_get("xmlcontent_xslt_path_$format", ''), - '#field_prefix' => drupal_get_path('module', 'xmlcontent'). '/', - '#description' => t('The file path to the XSLT script to be used for this format.'), + '#field_prefix' => 'Script location: ', + '#description' => t('URL for XSLT script, or file path relative to modules/xmlcontent/.'), ); $form['xmlcontent']['validation'] = array( '#type' => 'fieldset', @@ -210,12 +212,6 @@ function _xmlcontent_transform($xml, $pa return $xml; } - // check that the XSLT file exists - if (!is_file($path_to_xslt)) { - watchdog('xmlcontent',"XSLT unavailable, invalid file or path: '$path_to_xslt'", WATCHDOG_ERROR); - return $xml; - } - // Load the XML document $dom = new DomDocument('1.0', 'UTF-8'); $valid = $dom->loadXML($xml); @@ -227,7 +223,11 @@ function _xmlcontent_transform($xml, $pa // Load the XSLT script // TODO: is there a way to cache it, or not necessary $xsl = new DomDocument('1.0', 'UTF-8'); - $xsl->load($path_to_xslt); + $xslt_valid = $xsl->load($path_to_xslt); + if (!$xslt_valid) { + watchdog('xmlcontent', "Unable to load XSLT transformer '$path_to_xslt'", WATCHDOG_WARNING); + return $xml; + } // Create the XSLT processor $proc = new XsltProcessor();