Displaying only the first 5 articles

Burt Lewis

Usenet Archive
Joined
Sep 30, 2000
Messages
11
Reaction score
0
Hi,

I'm using an ASP script and an xsl file to display the feed from Boston.com on a web page.

http://www.boston.com/tools/rss/

It works nicely but I am having trouble limiting the number of articles (5)displayed on the page. Right now I get all articles and want to be able to choose how many that are shown.

Appreciate any help.

Here is the xsl file:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:eek:utput method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="*"> <table border="1" width="600" align="center"> <tr><td valign="top" align="center" class="title" bgcolor="silver" > <a> <xsl:attribute name="href"> <xsl:value-of select="*[local-name='channel']/*[local-name='link']"/> </xsl:attribute> <xsl:attribute name="target"> <xsl:text>top</xsl:text> </xsl:attribute> <xsl:value-of select="*[local-name='channel']/*[local-name='title']"/> </a> <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> <ul> <xsl:for-each select="//*[local-name='item']"> <a> <xsl:attribute name="href"> <xsl:value-of select="*[local-name='link']"/> </xsl:attribute> <xsl:attribute name="target"> <xsl:text>top</xsl:text> </xsl:attribute> <xsl:value-of select="*[local-name='title']"/> </a> | </xsl:for-each> </ul> </td></tr> </table> </xsl:template> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>
 

Janwillem Borleffs

Usenet Archive
Joined
Oct 10, 2001
Messages
1,000
Reaction score
0
Burt said:
It works nicely but I am having trouble limiting the number of articles (5)displayed on the page. Right now I get all articles and want to be able to choose how many that are shown.

Assuming that the following snippet is the one that produces the articles, you could change:

<xsl:for-each select="//*[local-name='item']">

Into :

<xsl:for-each select="//*[local-name='item' and position &lt; 6]">

JW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top