Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting record with XSL

Status
Not open for further replies.

ishfady

Programmer
Sep 14, 2002
31
GB
Hi

I have a following XML data file.

<ROWSET>
<ROW num="1">
<EVNAME>Gazzard</EVNAME>
<VISITDATE>08/09/2004</VISITDATE>
</ROW>
<ROW num="2">
<EVNAME>Gazzard</EVNAME>
<VISITDATE>08/03/2004</VISITDATE>
</ROW>
<ROW num="3">
<EVNAME>John</EVNAME>
<VISITDATE>07/04/2004</VISITDATE>
</ROW>
<ROW num="4">
<EVNAME>John</EVNAME>
<VISITDATE>15/01/2004</VISITDATE>
</ROW>
<ROW num="5">
<EVNAME>mike</EVNAME>
<VISITDATE>15/02/2004</VISITDATE>
</ROW>
</ROWSET>

I would like to find out and display, next to ENAME,
HOW MANY VISIT THEY DONE.
I have used following code, but no luck.

<xsl:template match="ROW">

<xsl:if test="position() = 1 or preceding-sibling::ROW [position() = 1]/EVNAME != EVNAME">
<tr class="evenRow">
<td align="center">&nbsp;<xsl:value-of select="EVNAME" /></td>
<td colspan="2">&nbsp;
<xsl:for-each select="EVNAME">
<xsl:value-of select="count(VISITDATE)" /> Visits,
</xsl:for-each>
&nbsp;&nbsp;<xsl:value-of select="count(//VISITDATE)" />.&nbsp;V
</td>
</tr>
</xsl:if>

</xsl:template>


Please can you help me.


many thank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top