|
Subject:
|
Count nodes based of if condition
|
|
Posted By:
|
suri_1811
|
Post Date:
|
12/7/2006 3:49:20 PM
|
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> </Task> <Task> <Do>Make a report</Do> </Task>
I want to show the Task nodes which contains attribute due="true", and need to put the dotted lines.after 5 tasks
thx suri
|
|
Reply By:
|
mhkay
|
Reply Date:
|
12/7/2006 7:00:50 PM
|
You want something like
<xsl:for-each select="Task[@due='true']"> .... <xsl:if test="position() mod 5 = 1"> <xsl:text>---------------</xsl:text> </xsl:if> </xsl:for-each>
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|