Suppress Repeating Values

Discussion in 'XML' started by Jon Bosker, Oct 1, 2003.

  1. Jon Bosker

    Jon Bosker Guest

    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>
    Jon Bosker, Oct 1, 2003
    #1
    1. Advertising

  2. Jon Bosker

    Jon Bosker Guest

    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
    Jon Bosker, Oct 16, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. peshrad
    Replies:
    3
    Views:
    1,500
    David Freeman
    Nov 8, 2004
  2. =?Utf-8?B?SmFzb24gUGV0dHlz?=

    Suppress viewstate __viewstate rendering

    =?Utf-8?B?SmFzb24gUGV0dHlz?=, Jan 14, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    2,902
    Steven Cheng[MSFT]
    Jan 18, 2005
  3. Replies:
    1
    Views:
    464
    Eliyahu Goldin
    Sep 10, 2007
  4. Holysmoke

    Suppress repeated values in DataGrid/DataList

    Holysmoke, Feb 3, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    88
    Holysmoke
    Feb 3, 2005
  5. stjulian

    GUID values repeating

    stjulian, Mar 26, 2007, in forum: ASP General
    Replies:
    2
    Views:
    174
    Tim Williams
    Mar 28, 2007
Loading...

Share This Page