Removing duplicates - grouping problem

Subject: Removing duplicates - grouping problem
From: Rebecca Crisafulli <crisa@xxxxxxxxxxx>
Date: Wed, 18 Oct 2000 13:14:32 -0400 (EDT)
 I am new to XSLT.  I have looked for the answer but no luck
 I am trying to group, sort and remove duplicates.  I can achieve the
 first two, but can not remove duplicates.
 
 For each term (see XML file), I want to group, sort and remove dups from
 the <sab>s (the term's source).
 
 I have tried variations of the Stylesheet with no luck.  The present
 stylesheet gives me grouped and sorted.  Help get rid of the duplicates.
 Hopefully this is a easy one for the pros on this mailing-list.
 Why does the 'not condition' in my select not take care of the duplicates.

 Run from command line --   java com.jclark.xsl.sax.Driver
 
 Thanks
 --Rebecca

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

<UMLSCollection>
<MetaGroup>
   <concept>
      <cn>Zygoma</cn>
      <term>
         <tn>Cheek Bone</tn>
         <termVariant>
            <str>Cheek Bone</str>
            <strSource>
               <sab>MSH2000</sab>
            </strSource> 
         </termVariant>
         <termVariant>
            <str>Cheek Bones</str>
            <strSource>
               <sab>MSH2000</sab>
            </strSource> 
         </termVariant>
         <termVariant>
            <str>Cheek-bone</str>
            <strSource>
               <sab>S0475897</sab>
            </strSource> 
            <strSource>
               <sab>MSH2000</sab>
            </strSource> 
         </termVariant>
      </term>
      <term>
         <tn>Jugal Bone</tn>
         <termVariant>
            <str>Jugal Bone</str>
            <strSource>
               <sab>MSH2000</sab>
            </strSource> 
         </termVariant>
      </term>
   </concept>
</MetaGroup>
</UMLSCollection>

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

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

<xsl:template match="UMLSCollection">
<html>
   <xsl:apply-templates/>
</html>
</xsl:template>

<xsl:template match="concept">
   Concept Name:  
   <xsl:value-of select="cn"/><br/>
   <xsl:apply-templates select="term"/>
</xsl:template>

<xsl:template match="term">
    <xsl:text> Synonym: </xsl:text>
    <xsl:value-of select="tn"/><br/>
    Source: <br/> 
    <xsl:for-each    
select="termVariant/strSource/sab[not(.=preceding-sibling::termVariant/st
rSource/sab)]">
       <xsl:sort select="."/>
       <xsl:value-of select="."/><br/>
    </xsl:for-each>
</xsl:template>




 
 


Rebecca A. Crisafulli
Commerce One
crisa@xxxxxxxxxxx
phone: 301-435-3250


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


Current Thread