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

Re: Removing Duplicate Nodes

Subject: Re: Removing Duplicate Nodes
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 7 Aug 2006 16:37:30 +0100
removing duplicates nodes in xml
On 8/7/06, Ashutosh Bhardwaj <ashubhardwaj@xxxxxxxxxx> wrote:
In the xml given below I need to get first 8 unique values for first
element of docvector field , like (mutual fund, paul murray):
<?xml version="1.0" encoding="utf-8" ?>

- <SEGMENT NAME="webcluster">


MAXRANK="3019" TIME="0.2233">

- <HIT NO="1" RANK="2604" SITEID="0" MOREHITS="0">

<FIELD NAME="rank">2604</FIELD>

   <FIELD NAME="docvector">[mutual fund, 1][fund sponsored,
0.953463][practice guidelines, 0.852803]</FIELD>


- <HIT NO="2" RANK="2293" SITEID="0" MOREHITS="0">

  <FIELD NAME="rank">2293</FIELD>
  <FIELD NAME="docvector">[mutual fund, 1][mutual fund,
0.816497][positions library, 0.57735]</FIELD>


- <HIT NO="3" RANK="2292" SITEID="0" MOREHITS="0">

<FIELD NAME="rank">2292</FIELD>

  <FIELD NAME="docvector">[paul murray, 1][mutual fund, 0.786796][lauren
hanlon, 0.690066]</FIELD>

This is a classic example of why name-value pair style xml is bad - as soon as you need to add more information to the value field you have to come up with proprietary syntax to wedge it in... then you get problems down the line when your data contains your chosen delimiter.... Much better to create an element with attributes or child elements.

Anyway, if you are using XSLT 1.0 then you need use muechian grouping
with some string processing extensions or recursive templates.

If you are using XSLT 2.0 then your life is much easier and you can
tackle this a number of ways - distinct-values() or for-each-group etc
but the problem is a bit underspecified at the moment.....

Current Thread


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.
First Name
Last Name
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.