Suppress Repeating Values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Bosker

    #1

    Suppress Repeating Values

    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>
    <timeDataDetail s>
    <Date>8/08/2003</Date>
    <StartTime>7: 25 AM</StartTime>
    <EndTime>7:31 AM</EndTime>
    </timeDataDetails >
    <timeDataDetail s>
    <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:styleshe et version="1.0"
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html><body><ta ble>
    <xsl:for-each select="/NewDataSet/timeDataDetails ">
    <tr>
    <td><xsl:valu e-of select="Date"/></td>
    <td><xsl:valu e-of select="StartTi me"/></td>
    <td><xsl:valu e-of select="EndTime "/></td>
    </tr>
    </xsl:for-each>
    </table></body></html>
  • Jon Bosker

    #2
    Re: Suppress Repeating Values

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

    Hope that helps
    Jon

    Comment

    Working...