views:

79

answers:

2

I was looking into xslt and started testing with the examples on w3schools.

However, when I save the xml and xsl in files and try opening them locally, chrome won't perform the xsl transform. It just shows a blank page.

I have added the <?xml-stylesheet type="text/xsl" href="style.xsl"> tag to the xml document, and firefox renders it as it is supposed to look. Also, if look at the files through a web server, chrome displays the file as it is supposed to look.

Is it that chrome has a problem finding the stylesheet information when the link is local? Changing the href to "file:///C:/xsl/style.xsl" didn't make any difference.

.

Update: This seems to be a side effect of a security-policy to not treat file:///* as same origin. This makes the following error appear in the console:

Unsafe attempt to load URL file:///C:/xsl-rpg/style.xsl from frame with URL file:///C:/xsl-rpg/data.xml. Domains, protocols and ports must match.

A: 

If you don't already have it, try adding the XHTML namespace to the stylesheet:

<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"&gt;
DevNull
A: 

It turns out that the issue is a bug/security feature in chrome.

Zaz