Home Archives Search About

TIL XML Has Stylesheets?!

Published February 5, 2021

Today I learned XML documents can have stylesheets! 😮

Browsing the comments of a recent HackerNews post on RSS led me to this comment which included a link to interconnected.org/home/feed. On first-pass this looks like a standard web page, but if you view the source1 it’s a raw RSS XML feed. Wtf?!

Turns out, there’s an XML-esque stylesheet language: XSLT. Others have done this before. Compared to CSS, the stylesheet for an XML document is just more XML. For example, the stylesheet to the aforementioned feed: interconnected.org/home/static/styles/pretty-feed-v2.xsl.

I think this is pretty neat and a clever solution to the problem of having a link to your feed (click it!) which either 1) renders raw XML or 2) prompts to download the feed2. Another option I’ve noticed around is having a landing page for your feed(s). Examples:

Makes me think I should consider revamping how I do things on this site. 🤔

Anyways, if you’re reading this and didn’t already know, you can subscribe to my feed! If you want a feed reader recommendation, I’m using Miniflux and enjoy it.

  1. Try it! Right-click > view source↩︎

  2. Technically there is a 3rd option: auto-open an installed feed reader↩︎

Last modified March 19, 2021   #til     #syndication  

← Newer post  •  Older post →