9

I have a XSLT sample copied straight from http://www.w3schools.com/xsl/xsl_transformation.asp, which I can't seem to view in Google Chrome. However, it seems to work fine in IE.

Does anyone know why this would be?

EDIT:

The online version works fine, but the local copy does not.

Community
  • 1
  • 1
Eric
  • 95,302
  • 53
  • 242
  • 374
  • The example linked to from that page (http://www.w3schools.com/xsl/cdcatalog_with_xsl.xml) seems to work just fine for me in Chrome (Chromium in fact, but that shouldn't matter). Does it work for you? If it works, then you need to check very carefully what's different in your setup. Check things like HTTP headers you send, for example. – Joachim Sauer May 25 '10 at 13:24
  • 1
    My problem only occurs when I copy the files to a local folder (both the XSLT and the XML). – Eric May 25 '10 at 13:37
  • Does the local copy contain the processing instruction on line two? The one starting with ``. Note that you **do not** see it when you use "display source" in Chrome. – Joachim Sauer May 25 '10 at 13:38
  • Yes, it does. Interesting how it doesn't appear in source view. – Eric May 25 '10 at 17:14
  • 1
    possible duplicate of [How can I make XSLT work in chrome?](http://stackoverflow.com/questions/2981524/how-can-i-make-xslt-work-in-chrome) – Dave Jarvis Jan 31 '13 at 17:09

2 Answers2

10

I had same issue with Google Chrome (tested on 13.0.782.215) and (non-JavaScript XSL transformation):

<?xml-stylesheet type="text/xsl" href="simple.xsl"?>

I found solution that works for me is to run Chrome browser with --allow-file-access-from-files switch:

// By default, file:// URIs cannot read other file:// URIs. This is an
// override for developers who need the old behavior for testing.
const char kAllowFileAccessFromFiles[]      = "allow-file-access-from-files";
Grzegorz Szpetkowski
  • 36,988
  • 6
  • 90
  • 137
2

Yeah, if you copied the sample down to a file on your computer, the xml won't work with xslt on chromium because it can't find your xslt file provided by just its filename. I've tried put both the xml file and the xslt file to a web server running on my computer and it worked.

If you don't have a web server on your computer, I have no solution with chromium. But maybe you can try a full path, maybe begun with "file:///C:/". Use other browser if that doesn't work...

Good luck, Max Xie

Max Xie
  • 21
  • 2