Title : RSS feed for OpenBSD stable packages repository (made with XSLT)
Author: Solène
Date : 05 June 2019
Tags : openbsd automation
I am happy to announce there is now a RSS feed for getting news in case of new
packages available on my repository
The file is available at [https://stable.perso.pw/rss.xml](https://stable.perso.pw/rss.xml).
I take the occasion of this blog post to explain how the file is generated as I
did not find easy tool for this task, so I ended up doing it myself.
I choosed to use **XSLT**, which is not quite common. Briefly, **XSLT** allows
to use some kind of XML template on a XML data file, this allow loops,
filtering etc... It requires only two parts: the template and the data.
**Simple RSS template**
The following file is a template for my RSS file, we can see a few tags
starting by `xsl` like `xsl:for-each` or `xsl:value-of`.
It's interesting to note that the `xsl-for-each` can use a condition like
`position < 10` in order to limit the loop to the 10 first items.
OpenBSD unofficial stable packages repository
</code></div> <div class='item'><span> </span><code> <xsl:value-of select="title"/></code></div> <div class='item'><span> </span><code>
**Simple data file**
Now, we need some data to use with the template.
I've added a comment block so I can copy / paste it to add a new entry into the
RSS easily. As the date is in a painful format to write for a human, I added to
my Makefile starting the commands a call to a script replacing the string DATE
by the current date with the correct format.
Firefox 67.0.1
Wed, 05 Jun 2019 06:00:00 GMT
I love makefiles, so I share it even if this one is really short.
When I want to add an entry, I copy / paste the comment block in news.xml, add
DATE, run `make` and it's uploaded :)
The command **xsltproc** is available from the package **libxslt** on OpenBSD.
And then, after writing this, I realise that manually editing the result file
rss.xml is as much work as editing the news.xml file and then process it with
xslt... But I keep that blog post as this can be useful for more complicated
cases. :)