0

When I use XML with xsl stylesheet, Chrome, Edge shows blank page. When I remove the stylesheet information from the XML file, the data is shown in tree structure.

What setting do I need to change in Chrome so that when I double click on XML file, it shows the data formatted.

Note: XML and XSL are in the same folder.

My XML File

<?xml-stylesheet type="text/xsl" href="people.xsl"?>
<people>
    <husband employed="Yes">
        <name>Mark</name>
        <age>45</age>
        <wife>
            <wname>Janet</wname>
            <age>29</age>
        </wife>
    </husband>
    <husband employed="No">
        <name>Matt</name>
        <age>42</age>
        <wife>
            <wname>Annie</wname>
            <age>41</age>
        </wife>
    </husband>
</people> 

My XSL file

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:template match="husband">
        <xsl:value-of select="name"/>
    </xsl:template>
</xsl:stylesheet>

I have installed Firefox also but it shows unformatted data.

Chrome Version : Version 122.0.6261.112 (Official Build) (64-bit)

Microsoft Edge Version: Version 122.0.2365.80 (Official build) (64-bit)

Firefox Version: 123.0.1 (64-bit)

I am on Windows 10 Pro

2
  • 1
    How are you running this? As an XSLT? Running it on XSLT Test Tool gives "Mark" and "Matt", which is correct. The problem is not with your code (that seems like a learning exercise) but with the way you're running it.
    – harrymc
    Mar 10 at 17:07
  • Yes its a learning exercise. I am double clicking the xml file which opens on chrome. That is how I am running it. I saw that in most of the tutorials on Youtube.
    – Shahid
    Mar 10 at 17:36

1 Answer 1

0

Local references from XML to XSL style sheets are blocked by default in all browsers now. You may be able to overcome this security restriction locally by stopping all running Chrome processes and starting a new Chrome browser instance using the "--allow-file-access-from-files" flag.

New contributor
Jeff is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .