RE: [xsl] Sort problem

Subject: RE: [xsl] Sort problem
From: "Eyal Shneider" <Eyal@xxxxxxxxxxxx>
Date: Fri, 26 Jan 2001 13:03:16 +0200
You have 4 characteristics for each item:
pageID,lineID,wordID and the word itself.

You need to define specifically what sorting you need.
Is it primary by word, secondary by wordID?
I supposed you needed sorting by : (pageID,lineID,wordID) in this exact
order of priority.
If you define for yourself the sorting priority list, the solution should be
very simple.

Eyal.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mick
Sent: Friday, January 26, 2001 12:45 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Sort problem


Eyal, this doesn't work. Perhaps I should have been more specific. If I
change the XML to for instance:

<root>
	<page pageID="1">
		<line lineID="1">
			<word wordID="1">a</word>
			<word wordID="2">A</word>
			<word wordID="3">c</word>
		</line>
		<line lineID="2">
			<word wordID="1">A</word>
			<word wordID="2">b</word>
			<word wordID="3">a</word>
		</line>
	</page>
</root>

the result I get is:

a, 1, 1, 1
A, 1, 1, 2
c, 1, 1, 3
A, 1, 2, 1
b, 1, 2, 2
a, 1, 2, 3

which is the order in which the word-elements appear but not in alphabetical
order, whereas I want:

a, 1, 1, 1
A, 1, 1, 2
A, 1, 2, 1
a, 1, 2, 3
b, 1, 2, 2
c, 1, 1, 3

Any other ideas?

-mick



original message:
Replace your sort command with these lines:

	<xsl:sort select="pageID" order="ascending"/>
	<xsl:sort select="lineID" order="ascending"/>
	<xsl:sort select="wordID" order="ascending"/>
This allows defining sort priority.
It should work.
Good luck!
Eyal.





 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