xsl-list
[Top] [All Lists]

RE: AW: Sorting Upper-Case first. Microsoft bug?

2003-08-05 11:18:14
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(_at_)nag(_dot_)co(_dot_)uk]
Sent: Tuesday, August 05, 2003 1:53 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: AW: [xsl] 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>&#10;</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