Making XML human-readable without XSLT

4 dfabulich 1 9/2/2025, 7:58:14 PM jakearchibald.com ↗

Comments (1)

dfabulich · 5h ago
This article proposes two options, one where you add a `<script>` tag in the XML body, which breaks validating parsers, and another approach where you attach CSS to the XML document with `<?xml-stylesheet type="text/css" href="styles.css"?>`, but this only works with `Content-Type: text/xml` and not `application/rss+xml` or `/atom+xml`.

It would be great if browsers were to support a header (or some other out-of-band signal) would allow me to attach some CSS + JS to my XML without any other changes to the XML content, and without changing the Content-Type header.

Specifically, I'd love to be able to keep my existing application/rss+xml or application/atom+xml Content-Type header and serve up a feed that satisfies a validating parser, but attaching CSS styling and/or JS content transformations.