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

RE: [xsl] Group and sort by group element occurrences


Subject: RE: [xsl] Group and sort by group element occurrences
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 19 Aug 2003 08:44:03 +0100

As a long time reader, you should know that you will get a reply asking
you to post your code! We can't tell you what you're doing wrong unless
you show us what you're doing.

(Someone might post you a solution, but not me. That's not just because
I'm too busy to write code for people, it's because I don't think it's a
good way of learning. Your error might be a simple typo, or it might
reflect a deep misunderstanding of the concepts, and before I can give
you useful advice, I need to know which is the case.)

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Simerman, Joshua Michael
> Sent: 19 August 2003 04:43
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Group and sort by group element occurrences
> 
> 
> 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
> 


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



Current Thread
Keywords
xml