[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: Ashutosh Bhardwaj <ashubhardwaj@xxxxxxxxxx>
Date: Mon, 07 Aug 2006 21:17:58 +0530
ashutosh bhardwaj
andrew welch wrote:
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" ?>
<SEGMENTS>

- <SEGMENT NAME="webcluster">

- <RESULTPAGE>

- <RESULTSET FIRSTHIT="1" LASTHIT="25" HITS="25" TOTALHITS="4353"
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>

- <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>

- <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.....



I am using XSLT 1.0 and trying to use muechian grouping,but not able to form correct expression. Also I need to get only first 8 elements and break recursion or loop after that.

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-2011 All Rights Reserved.