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 →