10
April
2020
Configuring the opening of XML extract files from Rosreestr with XSL style sheets
11:42

Configuring the opening of XML extract files from Rosreestr with XSL style sheets

10 April 2020 11:42

When opening files from a local drive, style sheets from the remote server are not applied. As a result, instead of a beautiful table, an error is displayed in the browser. For example, this situation occurs with XML extracts from Rosreestr.

A CORS (Cross-origin resource sharing) restriction prevents a page from loading resources outside of this site. When on CORS a page from a local disk cannot access resources on the Internet (these attempts are stopped by the browser). If you open an XML file, the style sheets are not loaded from the Rosreestr server and an error occurs:

"Error loading style sheet: An unknown error has occurred (805303f4)
https://portal.rosreestr.ru/xsl/EGRP/Reestr_Extract_Gkn/OKS/07/Common.xsl"

The solution to the problem with displaying XSL styles is quite simple: you need to use Mozilla Firefox with the "CORS Everywhere" extension enabled.

Step by step instructions:

  1. Install the extension in Mozilla Firefox extension "CORS Everywhere" -https://addons.mozilla.org/ru/firefox/addon/cors-everywhere/
  2. Sign in about:config and find the parameter security.fileurl.strict_origin_policy and change its value from true on false.
  3. In the menu about:addons in the CORS plugin settings, set the extension to automatically launch when the browser starts:
    setting up CORS extension
  4. Make Mozilla FireFox the default program for opening XML files (Click on the XML file in Explorer and select "Open with", click on "Show all applications" and select Mozilla Firefox. Check the "Open all files of this type" checkbox).
  5. Restart your FireFox browser.
  6. In the plugins panel, enable the extension - click on the pink square icon and the icon will change its color to green.

    enabling the CORS extension

Now XML files will be opened from a local disk using a style sheet from a remote server, that is, presented as a formatted HTML table.
Extract

Notes:

  • in some cases you need to additionally press F5, after which the XML document will be displayed in the correct form.
  • I tested the method in Mozilla Firefox 75.0 running Windows 8.1 and Windows 10 and Linux Mint 19.2 Tina.


Related publications