rsrsss/opml.xsl

66 lines
2.2 KiB
XML

<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:param name="current-date" />
<xsl:template match="channel">
<opml version="2.0">
<head>
<title>RSRSSS curated feeds</title>
<xsl:if test="$current-date">
<dateModified>
<xsl:value-of select="$current-date" />
</dateModified>
</xsl:if>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
<xsl:apply-templates select="item[category[@domain='https://envs.net/~lucidiot/rsrsss/' and text()='Feed'] and link]" />
</body>
</opml>
</xsl:template>
<xsl:template match="item[category[@domain='https://envs.net/~lucidiot/rsrsss/' and text()='Feed'] and link]">
<xsl:element name="outline">
<xsl:attribute name="type">rss</xsl:attribute>
<xsl:attribute name="text">
<xsl:value-of select="title" />
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="title" />
</xsl:attribute>
<xsl:attribute name="xmlUrl">
<xsl:value-of select="link" />
</xsl:attribute>
<xsl:if test="description">
<xsl:attribute name="description">
<xsl:value-of select="normalize-space(description)" />
</xsl:attribute>
</xsl:if>
<xsl:if test="pubDate">
<xsl:attribute name="created">
<xsl:value-of select="pubDate" />
</xsl:attribute>
</xsl:if>
<xsl:if test="category[@domain='https://envs.net/~lucidiot/rsrsss/' and text()!='Feed']">
<xsl:attribute name="category">
<xsl:for-each select="category[@domain='https://envs.net/~lucidiot/rsrsss/' and text()!='Feed']">
<xsl:text>/</xsl:text>
<xsl:value-of select="." />
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:template>
</xsl:stylesheet>