rss_converter_instagram.com.xsl: fix validation for Instagram location feeds
authorAntonio Ospite <ao2@ao2.it>
Sat, 24 Feb 2018 14:33:58 +0000 (15:33 +0100)
committerAntonio Ospite <ao2@ao2.it>
Sat, 24 Feb 2018 14:37:12 +0000 (15:37 +0100)
Avoid outputting an <image/> element without an empty <url/>, this
breaks validation.

src/rss_converter_instagram.com.xsl

index 58cc19c..a2de8b3 100644 (file)
                 </xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
                 </xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
+        <xsl:variable name="channel-image" select="//ProfilePage/user/profile_pic_url"/>
 
         <rss version="2.0">
             <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
 
         <rss version="2.0">
             <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
                     </xsl:if>
                     <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
                 </description>
                     </xsl:if>
                     <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
                 </description>
-                <image>
-                    <title>
-                        <xsl:value-of select="$channel-title"/>
-                    </title>
-                    <link>
-                        <xsl:value-of select="$channel-link"/>
-                    </link>
-                    <url>
-                        <xsl:value-of select="//ProfilePage/user/profile_pic_url"/>
-                    </url>
-                </image>
+                <xsl:if test="$channel-image != ''">
+                    <image>
+                        <title>
+                            <xsl:value-of select="$channel-title"/>
+                        </title>
+                        <link>
+                            <xsl:value-of select="$channel-link"/>
+                        </link>
+                        <url>
+                            <xsl:value-of select="$channel-image"/>
+                        </url>
+                    </image>
+                </xsl:if>
                 <xsl:apply-templates select="//ProfilePage/user/media/nodes|//LocationsPage/location/media/nodes"/>
             </channel>
         </rss>
                 <xsl:apply-templates select="//ProfilePage/user/media/nodes|//LocationsPage/location/media/nodes"/>
             </channel>
         </rss>