aboutfeeds icon indicating copy to clipboard operation
aboutfeeds copied to clipboard

XSL for presentation of Atom feeds

Open nhoizey opened this issue 4 years ago • 4 comments

I tried to use pretty-feed-v3.xsl for my Atom feeds, but it didn't work at all because Atom and RSS have different XML structures.

I tried to build an alternative version for Atom feeds, but I don't know if my specific Atom feeds match the common use case.

I also don't know if it would be possible to share a single XSL stylesheet for both RSS and Atom.

Here's my version: https://github.com/nhoizey/nicolas-hoizey.com/blob/main/src/assets/pretty-atom-feed-v3.xsl

Here's how it looks: https://nicolas-hoizey.com/feeds/all.xml

A few notes:

  • I removed the target="_blank" attributes for accessibility
  • I moved the code for each item in a specific <xsl:template> to ease maintenance

I can make a PR if you want to iterate over it.

nhoizey avatar Apr 29 '21 14:04 nhoizey

I just made a much lighter version without all CSS rules that were not used and using simple CSS instead of a bunch of utility classes: https://github.com/nhoizey/nicolas-hoizey.com/commit/ac2ad201c7649909e5c7f98f385ab152fac82850

Would you find it useful here?

nhoizey avatar Jan 29 '22 22:01 nhoizey

Works nicely for my Jekyll generated atom feed at https://jay.gooby.org/feed.xml

jaygooby avatar Apr 22 '22 13:04 jaygooby

I was about to write my own when I found this issue. It works flawlessly for my Atom feed, thank you @nhoizey! Would it be possible to merge your Atom XSL with this repository? Maybe we could have a pretty-feed-v3-rss.xsl and pretty-feed-v3-atom.xsl version here? This prevent newbies like myself to try to apply the RSS version to an Atom feed?

cimm avatar Apr 29 '22 11:04 cimm

Just stumbled upon this issue randomly: I recently made an XSL that works for both RSS and Atom: https://gist.github.com/Dan-Q/149579c66c938b566c45beefcf5914a4

The trick is to have a <xsl:for-each select="/rss/channel/item"> and a <xsl:for-each select="/atom:feed/atom:entry"> - the former iterates through the posts if it's an RSS feed, the latter if it's an Atom feed.

It's probably reasonably feasible to do similar things with the title etc.

Dan-Q avatar Jul 28 '23 18:07 Dan-Q