[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: AW: Sorting Upper-Case first. Microsoft bug?
Lemme see if I can put a bit of clarifying spin on the issue. Lexicographicly (is that a real word?), there is *NO* difference between 'CAT', 'Cat' and 'cat', or between 'DOG' , 'Dog' and 'dog'. Therefore, the upper-first or lower-first *should* never cause those 4 strings to be sorted 'cat dog Cat Dog CAT DOG' or 'CAT DOG Cat Dog cat dog'. What you should get for upper-first is 'CAT Cat cat DOG Dog dog', and for lower first, you should get 'cat Cat CAT dog Dog DOG'. For Mukul's example with 'a1' and 'A2' or 'A1' and 'a2', he got the proper results. 'a1' or 'A1' will always be before 'a2' or 'A2' because lexicographicly 'A' and 'a' are identical, therefore it falls to sorting on the '1' and '2' (case doesn't matter). The upper-first/lower-first is simply a way to have a *predicatable*, ordered result when you have the same string differing only in case (so you don't end up with 'cat CAT Cat DOG dog Dog' when sorting those strings with one initial order, but 'CAT cat Cat dog DOG Dog' when they have a different initial order). - Theo -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Tuesday, August 05, 2003 1:53 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: AW: Sorting Upper-Case first. Microsoft bug? > *It would be interesting to know how Saxon implements > this behaviour..* if M. Kay will be kind to answer.. He probably will but... <recordset name=""> <row ReturnValue="0" Store_ID="7" Location="WA4135" /> <row ReturnValue="0" Store_ID="5" Location="wA4131" /> <row ReturnValue="0" Store_ID="6" Location="WA4133" /> <row ReturnValue="0" Store_ID="8" Location="wA4136" /> <row ReturnValue="0" Store_ID="9" Location="WA4136" /> <row ReturnValue="0" Store_ID="10" Location="WA4138" /> <row ReturnValue="0" Store_ID="11" Location="WA4139" /> </recordset> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:template match="recordset"> <xsl:for-each select="row"> <xsl:sort select="@Location" data-type="text" order="ascending" case-order="upper-first"/> <xsl:text> </xsl:text> <xsl:copy-of select="."/> </xsl:for-each> </xsl:template> </xsl:stylesheet> $ saxon sort.xml sort.xsl <?xml version="1.0" encoding="utf-8"?> <row ReturnValue="0" Store_ID="5" Location="wA4131"/> <row ReturnValue="0" Store_ID="6" Location="WA4133"/> <row ReturnValue="0" Store_ID="7" Location="WA4135"/> <row ReturnValue="0" Store_ID="9" Location="WA4136"/> <row ReturnValue="0" Store_ID="8" Location="wA4136"/> <row ReturnValue="0" Store_ID="10" Location="WA4138"/> <row ReturnValue="0" Store_ID="11" Location="WA4139"/> ie it gets the same result as reported for other processors. I _still_ claim this is a bug though. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|