diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-01-26 00:30:53 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-01-26 00:54:55 +0900 |
commit | f7720b2207b33fd60ef945662c261c1468e377f7 (patch) | |
tree | b9a05fccca9e8a8a1e5a0fd2d519d0d83f0aa20f /atom.xslt | |
parent | 3f8a9cadb778c7a9aa6e4a396cbb3c5ec34ff409 (diff) | |
download | px-f7720b2207b33fd60ef945662c261c1468e377f7.tar.gz |
Add feed and build recipe
Diffstat (limited to 'atom.xslt')
-rw-r--r-- | atom.xslt | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/atom.xslt b/atom.xslt new file mode 100644 index 0000000..1bb4ecd --- /dev/null +++ b/atom.xslt @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="atom.xslt"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/2005/Atom"> + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + <xsl:variable name="root">https://px.cnx.gdn/</xsl:variable> + <xsl:template match="page"> + <xsl:variable name="base"> + <xsl:value-of select="$root"/> + <xsl:value-of select="@curr"/> + <xsl:text>/</xsl:text> + </xsl:variable> + <xsl:for-each select="post"> + <xsl:variable name="url"> + <xsl:value-of select="$base"/> + <xsl:text>#</xsl:text> + <xsl:value-of select="@id"/> + </xsl:variable> + <entry> + <link rel="alternate" type="application/xhtml+xml" href="{$url}"/> + <id><xsl:value-of select="$url"/></id> + <title><xsl:value-of select="translate(@id, '-', ' ')"/></title> + <content type="xhtml"> + <div xmlns="http://www.w3.org/1999/xhtml"> + <xsl:for-each select="picture"> + <img alt="{@desc}" title="{@desc}" + src="{$base}{@filename}.jpg"/> + </xsl:for-each> + </div> + </content> + <updated><xsl:value-of select="time"/></updated> + </entry> + </xsl:for-each> + </xsl:template> + + <xsl:template match="/"> + <feed xmlns="http://www.w3.org/2005/Atom"> + <link href="{$root}atom.xml" rel="self"/> + <link href="{$root}"/> + <id><xsl:value-of select="$root"/></id> + <icon><xsl:value-of select="$root"/>favicon.png</icon> + + <title>pix by cnx</title> + <author> + <name>Nguyễn Gia Phong</name> + <uri>https://cnx.gdn/</uri> + <email>mcsinyx@disroot.org</email> + </author> + <rights>CC BY-SA 4.0</rights> + <xsl:apply-templates select="document('00/index.xml')/page"> + </xsl:apply-templates> + <xsl:apply-templates select="document('01/index.xml')/page"> + </xsl:apply-templates> + <xsl:apply-templates select="document('02/index.xml')/page"> + </xsl:apply-templates> + <updated>2023-01-25T10:50:00Z</updated> + </feed> + </xsl:template> +</xsl:stylesheet> |