Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 7th, 2006, 04:49 PM
Authorized User
Join Date: Oct 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Count nodes based of if condition

Hi all

My stylesheet generates a text file.
I want to put dotted lines ----- after every 5 records in the output(text) file.
But, I have a if condition in the for-each loop.
See example, below

xml file

<Task due="true">
<Do>Call mother</Do>
<Do>Make a report</Do>

I want to show the Task nodes which contains
attribute due="true", and need to put the dotted lines.after 5 tasks


Reply With Quote
  #2 (permalink)  
Old December 7th, 2006, 08:00 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

You want something like

<xsl:for-each select="Task[@due='true']">
   <xsl:if test="position() mod 5 = 1">

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
QUERY EXECUTION based on IF condition drani C# 0 November 9th, 2007 04:14 PM
Pls help - Sorting based on condition kalwinhobbess Crystal Reports 0 September 10th, 2007 10:47 AM
popup based on condition msrnivas General .NET 0 July 11th, 2005 05:52 PM
XSL-help-sum of nodes baed on a condition skumar80 XSLT 2 November 8th, 2003 10:08 AM
count records where condition not true (IIF??) rpeksens Access 3 September 19th, 2003 03:36 PM

All times are GMT -4. The time now is 12:23 PM.

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