Search code examples
xmlfirefoxxsltxslt-1.0

XSLT stylesheet isn't applied to XML in Firefox. How to fix it?


I have no idea why my code isn't cooperating, with me and my xml. I'm sorry for giving pics, but when i'm giving code, site is displaying end result, not the code it self, and I have no idea how to change it.

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="movies.xsl" type="text/xsl" ?>
<collection>
    <movie>
        <title>hasdasd</title>
        <year>1222</year>
        <genre>horror</genre>
    </movie>
    <movie>
        <title>wqw</title>
        <year>1111</year>
        <genre>notporn</genre>
    </movie>
    <movie>
        <title>asdsd</title>
        <year>1444</year>
        <genre>comedy</genre>
    </movie>
</collection>

my XML code

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/collection">
      <html>
        <body> <h1>OEIHFWOEFIHEFOI</h1>
        <table border="1">
            <tr>
                <th>title</th>
                <th>Genre</th>
                <th>year</th>
            </tr>
            <xsl:for-each select="movie">
            <tr>
                <td><xsl:value-of select="title" /></td>
                <td><xsl:value-of select="year" /></td>
                <td><xsl:value-of select="genre" /></td>
            </tr>
            </xsl:for-each>
        </table>
        </body>
      </html>
  </xsl:template>
</xsl:stylesheet>

my XSLT code I really don't know whats wrong, it seems like they are connected to each other in a wrong way, but im still clueless.

end result


Solution

  • Firstly: I strongly recommend you use a local http server instead of modifying any preferences in Firefox that make you less secure.

    Since around Firefox 68 treats local files as always cross-origin. (See "local HTML file can lead to file stealing") This prevents various security and privacy issues such as an attack exfiltrating local data in the same folder as a downloaded HTML file. See also the article "Restrictions on File Urls".

    Changing security.fileuri.strict_origin_policy is extremely insecure and should not be done, because it allows access to all files on your computer.

    Edit: I previously suggested using privacy.file_unique_origin, which was less insecure, but that preference was removed around two years ago and doesn't work today.