MetaTrader five delivers an alternative to save optimization benefits into XML-file. Later it can be loaded in an external system which supports XML, such as Excel or other spreadsheet application. However, there can be circumstances when such applications are unavailable due to their specificity. On the other hand, a net browser is most probably present on every single Computer, exactly where MetaTrader runs. So, it would be excellent just to open the XML-file in the browser. If you do it straight away, you are going to see some thing like this.

The browser reports that it does not know how to render this web page and shows its raw representation. Even though it really is readable, it really is not uncomplicated to percept.

Essentially, the browser offers us a clue how to remedy the scenario. It says:

This XML file does not seem to have any style data related with it.

So, we will need to deliver the style data somehow.

Most acceptable way to do so is to use so-referred to as XSLT-transformation. To apply it to an XML file a single can make a compact edit in the file. Any text editor will suit.

For instance, if a typical MetaTrader five optimization report begins like this: 

<?xml version="1." encoding="UTF-eight" standalone="yes"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:o="urn:schemas-microsoft-com:workplace:workplace" xmlns:x="urn:schemas-microsoft-com:workplace:excel" xmlns:ss="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:workplace:workplace">
...

a single can add a single single line to it:

<?xml version="1." encoding="UTF-eight" standalone="yes"?>
<?xml-stylesheet variety="text/xsl" href="worksheet.xsl"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:o="urn:schemas-microsoft-com:workplace:workplace" xmlns:x="urn:schemas-microsoft-com:workplace:excel" xmlns:ss="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:workplace:workplace">
...

save, and reload in the browser. This will activate specified stylesheet (the file worksheet.xsl in the instance) on this XML file. Of course, the XSL-file will have to be placed beforehand in the identical folder exactly where the XML-file is situated.

The optimization report is essentially an Excel spreadsheet, so there exist quite a few prepared-produced stylesheets currently which can do the job. One particular of them, worksheet.xsl, is attached under.

The trouble with this method is that not all browsers will permit the XSL-file to load from your regional disk. Specificaly, a single of most preferred browsers – Chrome  – blocks this operation. If you attempt to load the edited XML in Chrome, you are going to get nothing at all except an error in the developer console:  

Unsafe try to load URL file:///…/worksheet.xsl from frame with URL file:///…/ReportOptimizer-xsl.xml. ‘file:’ URLs are treated as exceptional safety origins.

This “function” is extensively accepted in technical circles as a single of most odious choice of Chrome developers. No other browser apply this limitation, all of them assistance regional file loading initiated from regional pages (so if you use not Chrome, but other browser, you are going to get correct HTML for XML on this stage as for the other people, we will need to locate a workaround). With this remedy Google breaks consistency with other “styling” files (Cascading Style Sheets, CSS), which are also frequently loaded from the identical origin as hosted net-web page, and Chrome treats regional disk the identical origin in this case. All other browsers do the identical, of course.

To resolve the trouble with Chrome, we can run a net-server locally and access each XML and XSL files through HTTP protocol. Right now a single can locate quite a few lightweight and compact net-servers for private use, which are uncomplicated to set up on PCs.

In either way – if you use correct net browser (not a Chrome) or if you load XML/XSL files through a net-server – you are going to get the following web page as a outcome of XSLT transformation.

Web-page with optimization report (built using XSLT)

Not negative.

But there is an additional remedy. It utilizes abovementioned CSS. As an alternative of applying XSL to XML-file, we can apply CSS to XML. For undertaking so, a single should really edit the XML in the following way:

<?xml version="1." encoding="UTF-eight" standalone="yes"?>
<?xml-stylesheet variety="text/css" href="xml.css"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:o="urn:schemas-microsoft-com:workplace:workplace" xmlns:x="urn:schemas-microsoft-com:workplace:excel" xmlns:ss="urn:schemas-microsoft-com:workplace:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:workplace:workplace">
...

Right here we added the reference to CSS-file xml.css. It really is attached under as nicely.

If you realod the XML-file in the browser you are going to see some thing like this:

Web-page with optimization report (built using CSS)

It appears excellent.

This seamlessly operates with regional files and does not demand a regional net-server.

Please, note that the attached files are essentially worksheet.xsl and xml.css. The extra extension “.txt” was added due to the fact the weblog does not permit to attach files of original varieties. Following downloading you should really get rid of the excessive extensions.