Re: Atom 2 RSS Script? Anyone got one?
| From: | Thomas Goyne | Date: | Tue, 16 Nov 2004 00:46:45 +0000 |
| Subject: | Re: Atom 2 RSS Script? Anyone got one? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202104@lists.php.net to get a copy of this message | ||
On Sun, 14 Nov 2004 16:48:57 +0100 Nick Wilson <nick@stylesheet.org>
wrote:
hi all, im all tired out of searching, just cant seem to find a script that will convert atom 0.3 to any rss format. Does anyone have one or know where i can get hold of one?<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <xsl:output cdata-section-elements="description" /> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="atom:feed[@version='0.3']"> <xsl:element name="rss"> <xsl:attribute name="version">2.0</xsl:attribute> <xsl:element name="channel"> <xsl:apply-templates select="atom:title"/> <xsl:apply-templates select="atom:link[@type='text/html']/@href"/> <xsl:element name="description"> <xsl:value-of select="atom:tagline"/> </xsl:element> <xsl:apply-templates select="atom:modified"/> <xsl:element name="docs">http://backend.userland.com/rss</xsl:element> <xsl:apply-templates select="atom:entry"/> </xsl:element> </xsl:element> </xsl:template> <xsl:template match="atom:entry"> <xsl:element name="item"> <xsl:apply-templates select="atom:title"/> <xsl:apply-templates select="atom:link[@type='text/html']/@href"/> <xsl:element name="guid"> <xsl:attribute name="isPermaLink">false</xsl:attribute> <xsl:value-of select="atom:id"/> </xsl:element> <xsl:apply-templates select="atom:modified"/> <xsl:element name="description"> <xsl:choose> <xsl:when test="atom:content[@mode='escaped']"> <xsl:value-of select="atom:content" disable-output-escaping="yes"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="atom:content/*"/> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:element> </xsl:template> <xsl:template match="atom:title"> <xsl:element name="title"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="atom:link[@type='text/html']/@href"> <xsl:element name="link"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="atom:modified"> <xsl:element name="dc:date"> <xsl:value-of select="."/> </xsl:element> </xsl:template> </xsl:stylesheet> -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ http://www.smempire.org