IE9 and Chrome do not provide XML with XSL if XML is local and XSL is on a remote server

I have the following XML:

<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="http://www.test.com/AuditTrail.xsl"?> 

and XSL:

 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <html> <head><title>Test</title></head> </html> </xsl:stylesheet> 

This works fine in IE8, but not in IE9 or Chrome. I read that IE9 seems to prohibit downloading XSL from a remote server if the source XML file is on the local machine. Is there a way to force IE9 and Chrome to apply the remote XSL file to the local XML file without going into browser security settings? We have a desktop application that generates XML reports and displays them in a browser, is converted with style sheets hosted on a remote server.

+8
xml google-chrome internet-explorer-9 xslt
source share
2 answers

Does it work locally? I don’t think so, because there are some errors in XML and XSLT.

Chrome blocks local XML and XSLT processing! This is a problem, or they turned it off for security reasons. Check out this Chrome Bug Report for some workarounds.

IE9 has disabled support for a mix of local XML and remote XSLT. Also for security reasons! (I have no link for this)

Your XML must have at least one root element:

 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="http://www.test.com/AuditTrail.xsl"?> <hello/> 

and your XSLT should have some XSLT templates:

 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head><title>Test</title></head> </html> </xsl:template> </xsl:stylesheet> 

With these fixes, this example will work for IE8 and Firefox.
In Chrome, XML and XSLT must reside on a web server. In IE9, both must be on a web server or stored locally (no mixture).

+7
source share

We have a desktop application that generates reports and XML displays of them in a browser, style sheets hosted on a remote server

I think the easiest way is to load or save / save (the last copy) the stylesheet via the HTTP protocol on the user's local hard drive (using this application), and then perform a “completely legitimate” client-side conversion.

+3
source share

All Articles