Skip to content

Instantly share code, notes, and snippets.

@otherjoel
Created June 19, 2026 16:04
Show Gist options
  • Select an option

  • Save otherjoel/3cb0269157aea18038a404b754379554 to your computer and use it in GitHub Desktop.

Select an option

Save otherjoel/3cb0269157aea18038a404b754379554 to your computer and use it in GitHub Desktop.
Splitflap example of Atom feed with XSLT
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://example.com/transform.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">River City Library Blog</title>
<link rel="self" href="https://example.com/feed.atom" />
<link rel="alternate" href="http://example.com/blog" />
<updated>1912-06-21T00:00:00-06:00</updated>
<id>tag:example.com,2012:blog</id>
<generator uri="https://joeldueck.com/what-about/splitflap" version="1.2">Splitflap</generator>
<entry>
<title type="text">Chaucer, Rabelais and Balzac</title>
<link rel="alternate" href="https://example.com/first-post.html" />
<updated>1912-06-21T00:00:00-06:00</updated>
<published>1912-06-21T00:00:00-06:00</published>
<author>
<name>Marian Paroo</name>
<email>marian@example.com</email>
</author>
<id>tag:example.com,2012:blog.first-post</id>
<content type="html">&lt;article&gt;&lt;p&gt;My first post; content TK&lt;/p&gt;&lt;/article&gt;</content>
</entry>
</feed>
#lang racket/base
(require racket/file
splitflap)
(define my-id (mint-tag-uri "example.com" "2012" "blog"))
(define my-items
(list
(feed-item
(append-specific my-id "first-post") ; item-specific ID
"https://example.com/first-post.html" ; URL
"Chaucer, Rabelais and Balzac" ; title
(person "Marian Paroo" "marian@example.com") ; author
(infer-moment "1912-06-21") ; publish date
(infer-moment "1912-06-21") ; updated date
'(article (p "My first post; content TK")))))
(define my-feed
(feed
my-id ; tag URI
"http://example.com/blog" ; site URL
"River City Library Blog" ; Title
my-items))
(display-to-file
(parameterize ([feed-xslt-stylesheet "http://example.com/transform.xsl"])
(express-xml my-feed 'atom "https://example.com/feed.atom"))
"feed.atom" #:exists 'replace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment