Web Browser Errors on Local XSL File

This section provides examples of Web browser errors on loading local XSL files from local XML documents. Newer versions of Chrome, Firefox and Safari consider this as security risks.

Old versions of Web browsers can be used as XML XSL processors to apply XSL transformations included in local XML documents and display transformed outputs.

But new versions of Web browsers restrict XML XSL processing functionalities for remote files with "http:" protocol only.

It is considered as security risks to perform XML XSL transformations on local files with "file:" protocol. If you try it, you will get errors.

So if you want to use Web browsers as XML XSL processors, you have to create a local Web server and move your XML documents and their XSL documents to the Web server to apply XSL transformations and view transformed results.

Google Chrome Error on Local XSL Files

If you open "hello_xsl.xml" in Google Chrome, you will see nothing in the output window.

But if you click "... > More Tools > Developer Tools" menu, you will see an error in the console:

Unsafe attempt to load URL file:///Users/herong/hello.xsl 
from frame with URL file:///Users/herong/hello_xsl.xml. 
'file:' URLs are treated as unique security origins.
Google Chrome Error on Local XSL Files
Google Chrome Error on Local XSL Files

Mozilla Firefox Error on Local XSL Files

If you open "hello_xsl.xml" in Mozilla Firefox, you will see "Hello world!" in the output window.

But if you click "... > More Tools > Web Developer Tools" menu, you will see an error in the console:

Cross-Origin Request Blocked: The Same Origin Policy disallow 
reading the remote resource at file:///Users/herong/hello.xsl.
(Reason: CORS request not http)
Mozilla Firefox Error on Local XSL Files
Mozilla Firefox Error on Local XSL Files

Apple Safari Error on Local XSL Files

If you open "hello_xsl.xml" in Apple Safari, you will see nothing in the output window.

But if you click "Develop > Open Source Code" menu, you will see an error in the console:

Unsafe attempt to load URL file:///Users/herong/hello.xsl from 
origin null. Domains, protocols and ports must match.
Apple Safari Error on Local XSL Files
Apple Safari Error on Local XSL Files

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 XML-JSON Document Conversion

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating XML Documents Against Specified XML Schemas

XSL (Extensible Stylesheet Language) Introduction

 What Is XSL (Extensible Stylesheet Language)

 "Hello world!" Example of XSLT

Web Browser Errors on Local XSL File

 Java Implementation of XSLT

 XSLT (XSL Transformations) Introduction

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 PHP Extensions for XML Manipulation

 Processing XML with Python Scripts

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML Plugin Packages for Atom Editor

 XML 1.1 Changes and Parsing Examples

 Archived Tutorials

 References

 Full Version in PDF/EPUB