Welcome to weblogs.com.pk Sign in | Join | Help

XSLT :: Top N

Today I had to work on Classic ASP; I was integrating classifieds.com.pk’s RSS feed on a site developed using Classic ASP. An interesting scenario was that classifieds.com.pk RSS feed has many posts; and we wanted to show top 5 posts only. I used XSLT to transform the RSS feed (XML) into HTML. Here is the relevant portion of the XSLT to show top 5 posts!

<xsl:for-each select="item[position()&lt;6]">
    <
a>
        <
xsl:attribute name="href">
            <
xsl:value-of select="link" />
        </
xsl:attribute>
        <
xsl:attribute name="target">_blank</xsl:attribute>
        <
xsl:value-of select="title" disable-output-escaping="yes" />
    </
a> <small> (<xsl:value-of select="pubDate" />)</small>
    <
br />
</
xsl:for-each>

Published Friday, February 24, 2006 8:52 PM by khurram
Filed under:

Comments

# re: XSLT :: Top N

Saturday, February 25, 2006 1:31 AM by Adnan
XSLT is surely very powerful method for data formatting,i always wished to learn a bit about it but never got chance.
New Comments to this post are disabled