This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove duplicates from a list


This is always a grouping problem. For this the best way is using the
Muenchian Method: http://www.jenitennison.com/xslt/grouping/muenchian.html.

You have to group your <OBX> by the Observation_ID:

<xsl:key name="obx" match="OBX" use="@Observation_ID"/>

<xsl:template match="tdObsResults">
    <xsl:apply-templates select="OBX[count( . | key( 'obx',
@Observation-ID)[1] ) = 1]"/>
</xsl:template>

<xsl:template match="OBX">
    <xsl:value-of select="@Observation_ID"/>
</xsl:templaet>

Regards,

Joerg

----- Original Message -----
From: "Asim Tozlu" <Tozlu@optimal-systems.de>
To: <XSL-List@lists.mulberrytech.com>
Sent: Tuesday, January 29, 2002 4:31 PM
Subject: [xsl] Remove duplicates from a list


> Hi,
>
> i'm XSL-newbi. I have this XML:
>
> <tdObsResults>
> <OBX ObservationDT="2001-11-05T08:00:00"
> Observation_ID="1742-6"/>
> <OBX ObservationDT="2001-11-05T08:00:00"
> Observation_ID="1232-6"/>
> <OBX ObservationDT="2001-11-03T08:00:00"
> Observation_ID="1685-6"/>
> <OBX ObservationDT="2001-11-02T08:00:00"
> Observation_ID="1742-6"/>
> <OBX ObservationDT="2001-11-08T08:00:00"
> Observation_ID="1742-6"/>
> <OBX ObservationDT="2001-11-03T08:00:00"
> Observation_ID="1685-6"/>
> </tdObsResults>
>
> and i need this Result
> 1742-6
> 1232-6
> 1685-6
>
> Thanks for a Tip
>
> Asim


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]