[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

need to limit a For:each loop

Subject: need to limit a For:each loop
From: sales@xxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 5 May 2005 07:32:51 -0700
xsl for each limit
Hi,

I'm totally new to XSL (didn't know it existed till yesterday!) 
i downloaded a RSS newsfeed script for my website and started to modify
the design of it to suit my needs
the current output can be seen here
http://www.discountfirepagers.com/rss2/default.asp
as you can see there are many articles ... 
I wish to limit the articles to just 5 items. however i can't figure how
to modify the XSL to do that for me 
i know i have to break the for:each somehow or change it to a specified
loop but can't find any info on how to do this 
can someone help please 
Here is the XSL http://www.discountfirepagers.com/rss2/news.xsl
here is the XML
http://news.search.yahoo.com/news/rss?p=fire%20department


XSL

  <?xml version="1.0" ?> 
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> 
- <xsl:template match="*">
- <table border="0" width="100%" bgcolor="#666666" align="center">
- <tr>
- <td valign="top" bgcolor="white" class="headlines">
- <ul>
- <xsl:for-each select="//*[local-name()='item']">
- <li>
- <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>
- <font face="Verdana, Arial, Helvetica" color="#333333" size="0">
  <xsl:value-of select="*[local-name()='title']" /> 
  </font>
  </a>
  </li>
  </xsl:for-each>
  </ul>
  </td>
  </tr>
  </table>
  </xsl:template>
- <xsl:template match="/">
  <xsl:apply-templates /> 
  </xsl:template>
  </xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.