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

Group and sort by group element occurrences

Subject: Group and sort by group element occurrences
From: "Simerman, Joshua Michael" <jsimerma@xxxxxxxxxxx>
Date: Mon, 18 Aug 2003 22:42:42 -0500
group by sort
Long time reader, first time poster.

I have an xml doc that is the result of a keyword search, which list the
keyword, and all pages by id that have that instance of the keyword. The
output looks like this.

<?xml version="1.0" encoding="UTF-8"?>
<docroot>
	<token>apply
		<pageid>1</pageid>
		<pageid>3</pageid>
		<pageid>84</pageid>
	</token>
	<token>international
		<pageid>3</pageid>
		<pageid>5</pageid>
		<pageid>84</pageid>
	</token>
		<token>financial aid
		<pageid>5</pageid>
		<pageid>84</pageid>
	</token>
</docroot>

I need to transform this this into a grouped and sorted list of page
id's, so that the instances of pageid that occur the most frequently are
first, and so that each pageid is listed only once. The above xml would
then look like this.

<docroot>
	<pageid>84</pageid>
	<pageid>3</pageid>
	<pageid>5</pageid>
	<pageid>1</pageid>
</docroot>

It seems like a fairly simple transform, but I just cant get it to sort
properly and then have only the unique page ids. I just end up with a
flat list of the original document, or nothing at all.

Thanks,

Josh Simerman
Graduate Assistant, Web Developer
Systems & Accounting Graduate Programs
Indiana University, Kelley School of Business


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


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