[xsl] Sorting Problem

Subject: [xsl] Sorting Problem
From: "Dev Chandramani" <devc33@xxxxxxxxxxx>
Date: Wed, 12 Sep 2001 19:11:09 +0100
Hi,

I have the following example input XML doc :

<records>
	<pupil>
		<name>Smith</name>
		<school>Oxford</school>
	</pupil>
	<pupil>
		<name>Jones</name>
		<school>Eton</school>
	</pupil>
	<pupil>
		<name>Davis</name>
		<school>Eton</school>
	</pupil>
	<pupil>
		<name>Jones</name>
		<school>Oxford</school>
	</pupil>
	<pupil>
		<name>Davis</name>
		<school>Oxford</school>
	</pupil>
	<pupil>
		<name>Davis</name>
		<school>Cambridge</school>
	</pupil>
</records>

And I want the output similar to :

<records>
	<pupil>
		<name>Davis</name>
	</pupil>
	<pupil>
		<name>Jones</name>
	</pupil>
	<pupil>
		<name>Smith</name>
	</pupil>
<records>

Based on the frequency of the value in the <pupil> tag.
Any ideas would be greatly appreciated.
Also I want to introduce a weighting system so I can
then add the school field to the results based on
the weights I give each school.

For example if I had the following weights with 1 being the greatest:

	Cambridge=1
	Oxford=2
	Eton=3

I could then produce results such as :

<records>
	<pupil>
		<name>Davis</name>
		<school>Cambridge</school>
	</pupil>
	<pupil>
		<name>Jones</name>
		<school>Oxford</school>
	</pupil>
	<pupil>
		<name>Smith</name>
		<school>Oxford</school>
	</pupil>
<records>

I also would like <name> fields that only occur once being ordered using the
weighting system as well.

A tough problem I know but any advice on where to start would be greatly
appreciated.
Thanks in advance.

Regards,
Dev.


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


Current Thread