Avatar of Ricky11
Ricky11

asked on 

Use Style sheet to filter rss feed for images only??

The feed i need to parse and filter for images is

http://www.news.gov.hk/rss/news/topstories_en.xml

Some of the stories have images and some dont bascially i want the ones that have images?
can i use

I think i should be able to using a simple style sheet right?

below is the style sheet that i want to use for the above feed, but i dont know how to just filter the images ...

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>

<xsl:template match="rss">
  <!-- Do not show channel image -->
  <xsl:for-each select="channel/item[position() &lt; 2]">
   


    <xsl:value-of

select="title"/>
</br>

    <!-- only display markup for description if it's present

-->
    <xsl:value-of disable-output-escaping="yes"

select="description"/>

    </br>
   
</br>
  </xsl:for-each>
</xsl:template>

<xsl:template match="description">
 

    <xsl:value-of select="."/>
  </br>
</xsl:template>

</xsl:stylesheet>
Web Languages and Standards

Avatar of undefined
Last Comment
hielo

8/22/2022 - Mon