[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: easy distinctive sorting?

Subject: RE: easy distinctive sorting?
From: "Albert, Kevin" <kjalbert@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 31 Jul 2000 12:04:11 -0400
select distinctive sql
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.

Regards,
Kevin Albert

-----------------------------
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <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>

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

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

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

</xsl:stylesheet>
-----------------------------








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


Hi,

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:  http://www.mulberrytech.com/xsl/xsl-list


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.