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

Removing duplicates - grouping problem

Subject: Removing duplicates - grouping problem
From: Rebecca Crisafulli <crisa@xxxxxxxxxxx>
Date: Wed, 18 Oct 2000 13:42:49 -0400 (EDT)
rebecca crisafulli
 
 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

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.