5 ms·
You can very practically make this viewable in normal web browsers if you give it an XSLT stylesheet, and preferably use <content type="xhtml"> instead of <cont
by chrismorgan 3y ago
You can very practically make this viewable in normal web browsers if you give it an XSLT stylesheet, and preferably use <content type="xhtml"> instead of <content type="html"> so that you don’t even need any JavaScript to unescape things (grumble grumble, disable-output-escaping, grumble grumble, messy unmaintained XML pipelines with ancient feature support, grumble grumble).
Here’s a sample, having taken this feed.xml, switched it to <content type="xhtml">, and added my own stylesheet: https://temp.chrismorgan.info/2024-05-04-hn-40246841.xml https://temp.chrismorgan.info/2024-05-04-hn-40246841.xml
There’s all kinds of fun stuff you can then add, such as pagination as you get more entries, rather than just deleting old ones. I’d suggest adding actual links using the fragment and xml:id attribute (mapped to HTML id in the stylesheet), but that wouldn’t play nicely with pagination shifting entries.
You can even do things like publish an Atom entry document for each entry, so they have their own paths, but that that URL is still an Atom document. Basically, if you want to, you can completely realistically have a full blog where everything is in Atom containers instead of HTML containers.
- captn3m0 3y agoAn extension like Feed Preview also works well: https://code.guido-berhoerster.org/addons/firefox-addons/feed-preview/ https://code.guido-berhoerster.org/addons/firefox-addons/fee...
- chrismorgan 3y agoThat’s user-side. Giving the feed a stylesheet works for everyone, not requiring that they install an extension first.
- internetter 3y agoYou can even do it without switching the content type: https://boehs.org/in/blog.xml https://boehs.org/in/blog.xml
- chrismorgan 3y agoThat applies a CSS stylesheet to the XML tree directly, which has serious limitations: you can’t make links, you don’t get a document title, you don’t get a useful accessibility tree, you can’t change the order of the tree… I would always recommend using an XSL transformation first, in order to avoid these limitations.
- giantrobot 3y agoWhile XML and its ecosystem has faults, I love the model where annotated/hinted serialized data is sent to the client. The user agent is in charge of deciding how to display that data. It doesn't need a mountain of arbitrary third party code to display that data. I've done the "transform XML with XSLT in the browser" a few times before and it worked pretty well. Writing the XSLT was a pain in the ass because the tooling to do so sucked but once it was written it just worked. It even worked inside JavaScript since that could just grab that XML, ignore the stylesheet, then proceed because it was just an XHR. The modern JSON based equivalent is just an under specified mess. XML is actually pretty cool and useful. I find JSON to be a poor replacement.
- ciabattabread 3y agoOh man, XSLT stylesheets. I remember working with that for a templating engine for a college project. But I've haven't dealt with web programming since just before the iPhone achieved mass popularity. Is XSLT still a thing?
- dmorgan81 3y agoI doubt it's still used much in web programming, but for backend data processing there are plenty of systems that output XML. XSLT is a great resource when you need to simplify a gnarly document.
- neuronexmachina 3y agoThey come up sometimes in the GIS space when working with https://en.wikipedia.org/wiki/Geography_Markup_Language https://en.wikipedia.org/wiki/Geography_Markup_Language
- basscomm 3y ago> Is XSLT still a thing? On the frontend, not really. I built a small blog with XML and XSLT a few years ago and I was able to get things to mostly work, but XML and XSLT support in browsers is bad. It's been stuck at 1.0 with missing features for years and Chromium and FireFox both keep threatening to remove it. One day they will follow through with it.
- vallismortis 3y agoI love XSL. There are some problems that it is absolutely stellar at solving. NCBI recently changed their JATS schema. No need to change any code, just modify the stylesheet and everything hums along as if nothing changed.
- basscomm 3y agoMaking an XSLT stylesheet for an RSS feed is pretty easy, but I found out the hard way that you have to put about 512 characters of junk in your RSS file to do it. Otherwise browsers will just show unstyled XML no matter what else you do: See also: https://www.nfriedly.com/techblog/2009/06/how-to-use-xslt-to-style-an-rss-feed/ https://www.nfriedly.com/techblog/2009/06/how-to-use-xslt-to...
- chrismorgan 3y agoThat was fifteen years ago, back when most browsers tried to do useful things with feeds. They’ve all long since given up on that.
- basscomm 3y agoThe link is from 2009, but nothing has changed. I tried everything I could think of to style my RSS feed but nothing worked until I added a bunch of garbage at the top of the file to keep the browser from ignoring my instructions, and this was all the way back in 2020.
- chrismorgan 3y agoI’ve been styling Atom feeds with no bother since 2019, and worked with RSS feeds briefly in 2020 and likewise experienced no issues. The two browsers you were complaining about are IE, long dead, and Firefox, which removed its feed reading functionality in 2018. I can only assume that you’re misremembering when you last tried this, because what you’re describing simply doesn’t happen any more.
- basscomm 2y ago> I can only assume that you’re misremembering when you last tried this, because what you’re describing simply doesn’t happen any more. You assume incorrectly. The earliest date in my rss file is August 2019, which is the test entry I made to make sure it worked. Firefox dropped Live Bookmark support in December 2018, version 64.0. I was using Debian stable and Firefox ESR at the time, which was Firefox 60.9. So I did get bitten by this, but I decided to try styling rss feeds at the exact wrong time.