Guest losvatic Posted June 28, 2006 Share Posted June 28, 2006 Hello all,I new to XML/XSL and I need help please, I need to get the 5 latest press release from a XML feed that has about 20 in it. I thought this would be easy but I guess I was wrong. Here's what I've gotten so far:<xsl:for-each select="rss/channel/item"> <table width="500" border="0" cellpadding="3" cellspacing="0" class="table-bodycopy"> <tr> <td><a href="{link}" target="_blank" class="arialfont18"><xsl:value-of select="title"/></a></td> </tr> <tr> <td><xsl:value-of select="description"/></td> </tr> <tr> <td><xsl:value-of select="pubDate"/></td> </tr> <tr> <td> </td> </tr> <tr> <td><xsl:number level="any" count="title" format="0"/></td> </tr> </table> <br /></xsl:for-each>If someone could please tell me how to limit the number of items and/or time the for-each repeates through the nodes, I would be greatful.Thanks,Len Link to comment Share on other sites More sharing options...
kvnmck18 Posted June 29, 2006 Share Posted June 29, 2006 <xsl:for-each> loops the data you can limit the "looping" by Xpaths:http://www.w3schools.com/xpath/xpath_syntax.asp Link to comment Share on other sites More sharing options...
boen_robot Posted July 1, 2006 Share Posted July 1, 2006 ...and to be more precise, use a predicate. Something like this: <xsl:for-each select="rss/channel/item[position() <= 5"> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now