Subject: Re: New twist: eliminating nodes with duplicate content, case-ins ensi tive From: "Richman, Jeremy" <jrichman@xxxxxxxxxxxx> Date: Mon, 6 Dec 1999 11:37:51 -0500 |
My question is really how to eliminate duplicates, counting <handle>FOO</handle> and <handle>foo</handle> as duplicates. I still need an answer, if anyone knows one. <xsl:variable "unique-handles" select="//handle[not( self::node() = following::handle )]"/> In the above case, this variable would resolve to a node list of two nodes. How can I generate only one foo element in the output? (This is a simple example; my general problem includes other values, such as "bar", "BAR", also in the node list.) Jeremy Date: Fri, 3 Dec 1999 02:55:56 -0500 (EST) From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx> Subject: Re: New twist: eliminating nodes with duplicate content, case-insensi tive Jeremey, Use the translate function: translate(source,'ABC...Z','abc...z') Clark On Fri, 3 Dec 1999, Richman, Jeremy wrote: > Date: Fri, 3 Dec 1999 14:27:30 -0500 > From: "Richman, Jeremy" <jrichman@xxxxxxxxxxxx> > Reply-To: xsl-list@xxxxxxxxxxxxxxxx > To: 'xsl-list' <XSL-List@xxxxxxxxxxxxxxxx> > Subject: New twist: eliminating nodes with duplicate content, case-insensi tive > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: (no subject), Emiliano Cava (MSL) | Thread | Looking for CALS-to-FO stylesheet, Richman, Jeremy |
(no subject), Chen Hong Qiang | Date | xsl:attribute question, Richman, Jeremy |
Month |