Search code examples
xmlxsltoai

Prevent xslt to transform xml into html


I'm using OAI-PMH to retrieve records from data providers. My problem is that some of these data providers retrieve records using XSLT to transform XML response into HTML! As I need to parse and implement some stuff on their response, I need to have an XML response, not an HTML one.

So my question is: Is there a way to capture the XML before it becomes transformed into HTML ?

For instance this link illustrates what I explained. When I use Chrome Developer tool, go in the "Resources" tab, "Frames" item, and then "(OaiHandler)"->"OaiHandler", we can see the native xml.

Or should I have my own XSLT to transform back the HTML response into XML ? If it is the case, there is a standard XSLT provided to transform OAI-PMH data provider XML response into HTML. Are there tool capable to build the "inverse" XSLT ?


Solution

  • Looking a the link you posted in Firefox (any browser will do) and choosing View Source shows that the content returned in XML (not HMTL). However because of this line in the source...

    <?xml-stylesheet type="text/xsl" href="http://portal.dimdi.de/oai-gms/browser.xsl" ?>
    

    ...your web browser may load the referenced stylesheet to convert to HTML on your local PC for display purposes. The server is still sending you XML. If you were to access the same link using any HTTP client that does not execute stylesheets by default then you would just see the XML displayed

    On the other hand if the sever is sending you HTML directly (so view source shows ) then there is nothing you can do about that. It doesn't make sense that a providser would do this becuase they would not be adhering to the OAI Protocal Specification from what I can see.