Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2007, 12:27 PM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT - Don't Repeat if last record

In the code below, I would like the HR tag to not appear if the last record has been reached. How is this possible?
Code:
<xsl:for-each select="rss/channel/item[position() &lt;= $ItemsPerPage]">
    <xsl:sort select="pubDate" order="descending" />
    <li style="display: list-item;list-style-type: disc;list-style-image: url(_images/arrow.gif);list-style-position: outside;margin-bottom: 5px;margin-left: 25px;font-weight:bold"><a href="{link}"><xsl:value-of select="title"/></a></li>
    <li style="display: list-item;list-style-type: disc;list-style-image: url(_images/spacer.gif);list-style-position: outside;margin-left: 25px;"><xsl:value-of select="pubDate"/></li>

</xsl:for-each>
You can see what I'm talking about with the screenshot here: http://www.okoboji.com/xslt.jpg. I would like that bottom 'hr' tag to not appear.

Thanks in advance,
Matt

 
Old September 11th, 2007, 12:31 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Just put the in a <xsl:if> like this:

<xsl:if test="position()!=last()"></xsl:if>

/- Sam Judson : Wrox Technical Editor -/
 
Old September 11th, 2007, 12:33 PM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow Sam, thanks, that is one of the fastest and best replies I've ever had in any online forum. That worked like a champ.

Thanks,
Matt






Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeat single record in Crystal Report? jpryor Crystal Reports 1 April 11th, 2008 10:20 AM
'Repeat' a stored procedure Shaneus BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 February 14th, 2008 06:49 AM
no repeat selection! masgas MySQL 2 February 18th, 2006 01:17 PM
xslt with multiple occurrences in a record Olaf_l XSLT 2 April 7th, 2005 07:02 AM
Repeat Region with a difference. fatmcgav Dreamweaver (all versions) 2 January 17th, 2005 05:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.