project/ ├── data.xml └── style.xslt
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="style.xslt"?> <!-- or subfolder --> <?xml-stylesheet type="text/xsl" href="xslt/style.xslt"?> Instead of opening files directly ( file:// ), serve them via http://localhost .
npx http-server -p 8000 ⚠️ Only use this for local testing – do not browse normally with this flag.
The root cause is Chrome's security policy. The cleanest solution is to use a local web server instead of opening XML files directly from disk.
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="style.xslt"?> <root> <item>Hello World</item> </root>
Then open http://localhost:8000/data.xml