This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: removing duplicate nodes
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] removing duplicate nodes
- From: "Uslu, Cihan Y (MED)" <Cihan dot Uslu at med dot ge dot com>
- Date: Thu, 19 Jul 2001 12:53:23 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Chris,
Thank you for your reply, after trying to find the solution I came up
with this little script, it's kind of slow and I still get some
duplicate nodes when there are TERMs whose text value's initial
character is typed in lower-case while the next one's initial chacater
is typed in upper-case. So when I try to remove the duplicate nodes, I
can not get rid of the ones that are same in context but different as a
string value.
What is the best way to do this?Thank you for the reply in advance,
regards
---------------------
<xsl:for-each select="//glossterm"> <!-- process all glossterms -->
<xsl:sort select="TERM" />
<xsl:variable name="term" select="TERM" />
<xsl:variable name="defn" select="DEFN" />
<xsl:if
test="not(preceding-sibling::glossterm[TERM=$term])">
<xsl:if
test="not(preceding-sibling::glossterm[DEFN=$defn])">
<p><b><xsl:value-of
select="concat(translate(substring($term,1,1),'abcdefghijklmnopqrstuvwxy
z','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring($term, 2))" />
<xsl:text>:</xsl:text></b>
<xsl:value-of
select="concat(translate(substring($defn,1,1),'abcdefghijklmnopqrstuvwxy
z','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring($defn, 2))" /> </p>
</xsl:if>
</xsl:if>
</xsl:for-each>
-----------------------
-----Original Message-----
From: Chris Bayes [mailto:Chris@Bayes.co.uk]
Sent: Wednesday, July 18, 2001 7:02 PM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] removing duplicate nodes
Cihan,
<xsl:template match="DEFN">
<xsl:if test="text() != preceding::DEFN/text()">
<xsl:value-of select="." />
</xsl:if>
</xsl:template>
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
>-----Original Message-----
>From: owner-xsl-list@lists.mulberrytech.com
>[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of B. Tommie
>Usdin
>Sent: 18 July 2001 23:50
>To: xsl-list
>Subject: [xsl] removing duplicate nodes
>
>
>>From: "Uslu, Cihan Y (MED)" <Cihan.Uslu@med.ge.com>
>>To: xsl-list@lists.mulberrytech.com
>>Subject: HELP:removing duplicate nodes
>>Date: Wed, 18 Jul 2001 11:21:39 -0500
>
>
>
>>Hi;
>>I have a XML document as following:
>>--------------------------------
>><glossary>
>> <glossterm>
>> <TERM>Cyst</TERM>
>> <DEFN TargetUser="FE">fluid- filled (echo-free) with
>>well-defined walls and posterior acoustic enhancement</DEFN>
>> </glossterm>
>> <glossterm>
>> <TERM>Cyst</TERM>
>> <DEFN TargetUser="FE">fluid- filled (echo-free) with
>>well-defined walls and posterior acoustic enhancement</DEFN>
>> </glossterm>
>> <glossterm Language="English" Revision="1.0"
>>ProprietaryClass="A" CourseNum="US506" OriginatingGroup="LS"
>>Owner="Ultrasound Training">
>> <TERM>Anechoic</TERM>
>> <DEFN TargetUser="FE">refers to a structure that
>>transmits ultrasound without
>> reflecting sound back to
>>its source.</DEFN>
>> </glossterm>
>> <glossterm Language="English" Revision="1.0"
>>ProprietaryClass="A" CourseNum="US506" OriginatingGroup="LS"
>>Owner="Ultrasound Training">
>> <TERM>Echolucent</TERM>
>> <DEFN TargetUser="FE">no echoes</DEFN>
>> </glossterm>
>> <glossterm>
>> <TERM>cyst</TERM>
>> <DEFN TargetUser="FE">fluid- filled (echo-free) with
>>well-defined walls and posterior acoustic enhancement</DEFN>
>> </glossterm>
>>
>> <glossterm Language="English" Revision="1.0"
>>ProprietaryClass="A" CourseNum="US506" OriginatingGroup="LS"
>>Owner="Ultrasound Training">
>> <TERM>Heterogenous</TERM>
>> <DEFN TargetUser="FE">different textures</DEFN>
>> </glossterm>
>> ......
>>...
>>
>></glossary>
>>
>>----------------------------------------
>>
>>I want my output to be;
>>---------------------------------------------
>>Cyst: fluid- filled (echo-free) with well-defined walls and posterior
>>acoustic enhancement
>>Anechoic: refers to a structure that transmits ultrasound without
>>reflecting sound back to its source
>>Echolucent: no echoes
>>Heterogenous: different textures
>>-----------------------------------------------
>>
>>With my XSL scipt I get everything, including duplicate node with
their
>>text nodes included. If there is a duplicate node and the text node is
>>same I dont want it in my output (if the text node is different then,
I
>>want it to be shown) How can I do that?
>>Thank you for the help.
>>
>>Cihan
>
>
>--
>======================================================================
>B. Tommie Usdin mailto:btusdin@mulberrytech.com
>Mulberry Technologies, Inc. http://www.mulberrytech.com
>17 West Jefferson Street Phone: 301/315-9631
>Suite 207 Direct Line: 301/315-9634
>Rockville, MD 20850 Fax: 301/315-8285
>----------------------------------------------------------------------
> Mulberry Technologies: A Consultancy Specializing in SGML and
>XML
>======================================================================
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list