RE: easy distinctive sorting?

Subject: RE: easy distinctive sorting?
From: "Albert, Kevin" <kjalbert@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 31 Jul 2000 12:04:11 -0400
Here is a stylesheet that was posted to the list a while back by Mark Volkman, which I think will help you .... the key is in testing whether the context node is equivalent to preceding-sibling.

Kevin Albert

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"

  <xsl:template match="/">
    <h2>Original List</h2>
    <xsl:apply-templates select="list"/>

    <h2>Sorted List w/ No Duplicates</h2>
    <xsl:apply-templates select="list" mode="sort-nodup"/>

  <xsl:template match="list">
    <xsl:apply-templates select="item"/>

  <xsl:template match="list" mode="sort-nodup">
    <xsl:apply-templates select="item[not(.=preceding-sibling::item)]">

  <xsl:template match="item">
      <xsl:value-of select="."/>


-----Original Message-----
From: Hugo de Groot []
Sent: Monday, July 31, 2000 9:32 AM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: easy distinctive sorting?


One of my XSL stylesheets should output sorted elements, with an extra difficulty that there can be several identical elements, which should be included only once. If I would use SQL I'd probably use the statement 'SELECT DISTINCT'. I haven't found an easy way of doing this in XSL. Does anyone have a suggestion (apart from writing a custom template)?

Hugo De Groot
X punt X b.v. IT Services

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread