Google Chrome wont render the XML with xml-stylesheet

344 Views Asked by At

The Setup

I am using Flask in debug mode on my local machine & Google Chrome to check on my routes.

The Goal

I would like to render an XML response using this xml stylesheet. The response (incl. the xml-stylesheet tag) looks as follows (checking source in Google Chrome):

<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="127.0.0.1:8887/oaitohtml.xsl"?><OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
  <responseDate>2020-06-27T17:54:43Z</responseDate>
  <request verb="Identify">base_url</request>
  <Identify>
    <repositoryName>the_project</repositoryName>
    <baseURL>base_url</baseURL>
    <protocolVersion>2.0</protocolVersion>
    <adminEmail>[email protected]</adminEmail>
    <earliestDatestamp>2011-01-01T00:00:00Z</earliestDatestamp>
    <deletedRecord>persistent</deletedRecord>
    <granularity>YYYY-MM-DDThh:mm:ssZ</granularity>
    <compression>gzip</compression>
    <compression>deflate</compression>
  </Identify>
</OAI-PMH>

What Goes Wrong?

However, when looking at the route in Google Chrome (localhost:5000/oai) in my case, I get only raw text output:

2020-06-27T18:01:41Z base_url the_project base_url 2.0 [email protected] 2011-01-01T00:00:00Z persistent YYYY-MM-DDThh:mm:ssZ gzip deflate

What I Tried

I read that google does not allow reading files from files (e.g. having it in my static folder) due to security reasons, hence I tried to serve the file via Web Server for Chrome plugin. When I go to 127.0.0.1:8887/oaitohtml.xsl, I can indeed see the stylesheet.

What am I missing to make this work?

Cheers!

0

There are 0 best solutions below