diff options
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> |