diff --git a/lib/filelib.php b/lib/filelib.php
index 0d18cfa..ae59bac 100644
--- a/lib/filelib.php
+++ b/lib/filelib.php
@@ -2216,7 +2216,7 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss
 
     } else {
         // Try to put the file through filters
-        if ($mimetype == 'text/html') {
+        if ($mimetype == 'text/html' || $mimetype == 'application/xhtml+xml') {
             $options = new stdClass();
             $options->noclean = true;
             $options->nocache = true; // temporary workaround for MDL-5136
@@ -2373,7 +2373,7 @@ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownl
         readfile_accel($stored_file, $mimetype, !$dontdie);
 
     } else {     // Try to put the file through filters
-        if ($mimetype == 'text/html') {
+        if ($mimetype == 'text/html' || $mimetype == 'application/xhtml+xml') {
             $options = new stdClass();
             $options->noclean = true;
             $options->nocache = true; // temporary workaround for MDL-5136
diff --git a/mod/resource/lib.php b/mod/resource/lib.php
index 8243c5b..15da0ae 100644
--- a/mod/resource/lib.php
+++ b/mod/resource/lib.php
@@ -425,7 +425,7 @@ function resource_pluginfile($course, $cm, $context, $filearea, $args, $forcedow
 
     // should we apply filters?
     $mimetype = $file->get_mimetype();
-    if ($mimetype === 'text/html' or $mimetype === 'text/plain') {
+    if ($mimetype === 'text/html' or $mimetype === 'text/plain' or $mimetype === 'application/xhtml+xml') {
         $filter = $DB->get_field('resource', 'filterfiles', array('id'=>$cm->instance));
         $CFG->embeddedsoforcelinktarget = true;
     } else {
