RE: [xsl] Sort problem

Subject: RE: [xsl] Sort problem
From: "Eyal Shneider" <Eyal@xxxxxxxxxxxx>
Date: Fri, 26 Jan 2001 12:17:27 +0200
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.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mick
Sent: Friday, January 26, 2001 11:58 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Sort problem


Hello all. I have the following XML (using IE 5.5):

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

What I want is an alphabetical list of all words, followed by pageID, lineID
and wordID in the order as they appear. I have the following XSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:template match="/">

<xsl:for-each select="root/page/line/word">
	<xsl:sort select="." order="ascending"/>
		<xsl:value-of select="."/>,
		<xsl:value-of select="../../@pageID"/>,
		<xsl:value-of select="../@lineID"/>,
		<xsl:value-of select="@wordID"/><br/>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

The result I get is:

a, 1, 1, 1
a, 1, 1, 3
a, 1, 2, 2
a, 1, 2, 3
A, 1, 1, 2
A, 1, 2, 1

which is not what I want. The desired output should be:

a, 1, 1, 1
A, 1, 1, 2
a, 1, 1, 3
A, 1, 2, 1
a, 1, 2, 2
a, 1, 2, 3

thus ingoring capital letters. This is just an example, there can be other
letters there as well. Has anyone got any ideas how to do this?

-mick




 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
  • [xsl] Sort problem
    • Mick - Fri, 26 Jan 2001 10:58:07 +0100
      • Michael Kay - Fri, 26 Jan 2001 11:18:14 -0000
        • Mick - Fri, 26 Jan 2001 12:31:01 +0100
      • <Possible follow-ups>
      • Eyal Shneider - Fri, 26 Jan 2001 12:17:27 +0200 <=
        • Mick - Fri, 26 Jan 2001 11:44:54 +0100
      • Eyal Shneider - Fri, 26 Jan 2001 13:03:16 +0200
        • Mick - Fri, 26 Jan 2001 12:25:23 +0100
      • Eyal Shneider - Fri, 26 Jan 2001 13:43:38 +0200