Suppress Repeating Values

J

Jon Bosker

Hi

I am trying to get my timesheet report to look good but my date keeps
repeating and I do not want it to. I cannot understand how to
implement the Meuchian technique here though it seems to be along the
right lines.

Can anyone help me? I struggle with this XML stuff :(

At the moment my output looks like:
8/08/2003 7:25 AM 7:31 AM
8/08/2003 7:32 AM 5:23 PM

But I want it to look like:
8/08/2003 7:25 AM 7:31 AM
7:32 AM 5:23 PM <-- no date on 2nd line becuase it is
the same

My data looks something like this:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<timeDataDetails>
<Date>8/08/2003</Date>
<StartTime>7:25 AM</StartTime>
<EndTime>7:31 AM</EndTime>
</timeDataDetails>
<timeDataDetails>
<Date>8/08/2003</Date>
<StartTime>7:32 AM</StartTime>
<EndTime>5:23 PM</EndTime>
</timeDataDetails>
</NewDataSet>

and my style sheet looks something like this (note: I am outputting to
HTML table):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html><body><table>
<xsl:for-each select="/NewDataSet/timeDataDetails">
<tr>
<td><xsl:value-of select="Date"/></td>
<td><xsl:value-of select="StartTime"/></td>
<td><xsl:value-of select="EndTime"/></td>
</tr>
</xsl:for-each>
</table></body></html>
 
J

Jon Bosker

In case anybody is having a similar problem I found a solution. It is as follows:
<xsl:if test="not(preceding-sibling::timeDataDetails[Date = current()/Date])">
<xsl:value-of select="Date"/>
</xsl:if>

Hope that helps
Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top