[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

New twist: eliminating nodes with duplicate content, case-insensi tive


Subject: New twist: eliminating nodes with duplicate content, case-insensi tive
From: "Richman, Jeremy" <jrichman@xxxxxxxxxxxx>
Date: Fri, 3 Dec 1999 14:27:30 -0500

I want to create a node set of all nodes of a certain type, eliminating
duplicates using
case-insensitivity, then convert all notes to lower case.

If I have this xml:

<handle-list>
  <handle>RED DOG</handle>
  <handle>Red Dog</handle>
  <handle>Goldfish</handle>
</handle-list>

And I'd like to generate just:

<handle-list>
   <handle>goldfish</handle>
   <handle>red dog</handle>
<handle-list>

How can I do this?  I realize the translate function must be used to change
from upper to lower.
But the only function I have to eliminate duplicates is case sensitive, e.g.

<xsl:variable "unique-handles" select="//handle[not( self::node() =
following::handle )]"/>

If use then process the nodes in unique-handles, I'll get a nodeset that
includes all of the original handle elements,
instead of just two.

I could possibly create a pretty complicated looping construct of several
templates, that for each node in the
$unique-handles nodeset, iterates over the following nodes in the set, using
translate to look for duplicates.

Any ideas?

Jeremy Richman



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



Current Thread