XSLT Repeat

I want to get an XSLT fragment (in Dreamweaver) to repeat a fixed number of times. The code below works fine but it returns all results and not a fixed number. How would I change this to only display 5 articles at a time?

<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="http://next.discovermine.com/Export/BucketRSS.asmx/Get?bid=1069641" -->
<!DOCTYPE xsl:stylesheet  [
      <!ENTITY nbsp   "&#160;">
      <!ENTITY copy   "&#169;">
      <!ENTITY reg    "&#174;">
      <!ENTITY trade  "&#8482;">
      <!ENTITY mdash  "&#8212;">
      <!ENTITY ldquo  "&#8220;">
      <!ENTITY rdquo  "&#8221;">
      <!ENTITY pound  "&#163;">
      <!ENTITY yen    "&#165;">
      <!ENTITY euro   "&#8364;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/">
  <xsl:for-each select="rss/channel/item">
    <strong><img src="images/rssitem_sm.gif" width="16" height="16" /><font size="-1">&nbsp;<a href="{link}" target="_blank"><xsl:value-of select="title"/></a></font></strong><br />
    <font size="-2"><xsl:value-of select="pubDate"/></font><br />
    <font size="-1"><xsl:value-of select="description" disable-output-escaping="yes"/></font><br />
    <br />
  </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
KBueschingAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
sorry, the EE forum ruined my code
<xsl:for-each select="rss/channel/item[position() &lt;= 5]">

Open in new window

0
 
Geert BormansInformation ArchitectCommented:
<xsl:for-each select="rss/channel/item">
should become
<xsl:for-each select="rss/channel/item[position() <= 5]">
0
 
KBueschingAuthor Commented:
Perfect - works as expected, thanks for the help.
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.