--- /dev/null
+<!--
+ Stylesheet to convert Instagram user timelines to RSS.
+
+ Copyright (C) 2015 Antonio Ospite <ao2@ao2.it>
+
+ This file is part of tweeper.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl"
+ xsl:extension-element-prefixes="php"
+ exclude-result-prefixes="php">
+
+ <xsl:param name="generateEnclosure"/>
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:variable name="BaseURL">
+ <xsl:text>https://instagram.com</xsl:text>
+ </xsl:variable>
+
+ <xsl:template match="images">
+ <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generate_enclosure', string(./standard_resolution/url))"/>
+ </xsl:template>
+
+ <xsl:variable name="screen-name" select="//UserProfile/XML_Serializer_Tag/user/full_name"/>
+ <xsl:variable name="user-name" select="//UserProfile/XML_Serializer_Tag/user/username"/>
+
+ <xsl:template match="//userMedia/XML_Serializer_Tag">
+ <xsl:variable name="item-content-title" select="./caption/text"/>
+ <xsl:variable name="item-content-src" select="./images/standard_resolution/url"/>
+ <xsl:variable name="item-permalink" select="./link"/>
+ <item>
+ <title>
+ <xsl:value-of select="concat($user-name, ': ', $item-content-title)"/>
+ </title>
+ <link>
+ <xsl:value-of select="$item-permalink"/>
+ </link>
+ <guid>
+ <xsl:value-of select="$item-permalink"/>
+ </guid>
+ <pubDate>
+ <xsl:variable name="timestamp" select="./created_time"/>
+ <xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', number($timestamp))"/>
+ </pubDate>
+ <description>
+ <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
+ <p><xsl:value-of select="$item-content-title"/></p><br />
+ <img src="{$item-content-src}" title="{$item-content-title}" />
+ <xsl:text disable-output-escaping="yes">]]></xsl:text>
+ </description>
+ <xsl:if test="$generateEnclosure = 1">
+ <xsl:apply-templates select="./images"/>
+ </xsl:if>
+ </item>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <xsl:variable name="channel-title" select="concat('Instagram / ', $screen-name)"/>
+ <xsl:variable name="channel-link" select="concat($BaseURL, //user/__path)"/>
+
+ <rss version="2.0">
+ <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
+ <channel>
+ <generator>Tweeper</generator>
+ <title>
+ <xsl:value-of select="$channel-title"/>
+ </title>
+ <link>
+ <xsl:value-of select="$channel-link"/>
+ </link>
+ <description>
+ <xsl:value-of select="//user/bio"/>
+ </description>
+ <image>
+ <title>
+ <xsl:value-of select="$channel-title"/>
+ </title>
+ <link>
+ <xsl:value-of select="$channel-link"/>
+ </link>
+ <url>
+ <xsl:value-of select="//user/profile_picture"/>
+ </url>
+ </image>
+ <xsl:apply-templates select="//userMedia/XML_Serializer_Tag"/>
+ </channel>
+ </rss>
+ </xsl:template>
+</xsl:stylesheet>