[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sorting Upper-Case first. Microsoft bug?

Subject: Sorting Upper-Case first. Microsoft bug?
From: Yago Alvarado <Yago.Alvarado@xxxxxxxxxxxxxx>
Date: Tue, 5 Aug 2003 11:51:47 +0100
xsl upper case
Hi!

   I'm not quite sure whether this is a bug in the Microsoft Parser
(Microsoft XML 4.0)
or it's me doing something wrong...

According to the W3C Recommendation:

----------------------->8---------------------->8--------------------------
case-order has the value upper-first or lower-first; this applies when
data-type="text", and specifies that upper-case letters should sort before
lower-case letters or vice-versa respectively. For example, if lang="en",
then A a B b are sorted with case-order="upper-first" and a A b B are sorted
with case-order="lower-first". The default value is language dependent.
----------------------->8---------------------->8--------------------------


I'm trying to sort some xml and I want to show first the elements in upper
case 
and then the ones in lower case. See xml/xsl below:


XML
---

<?xml version="1.0" encoding="iso-8859-1" ?>
<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>


Please note I've changed some of the Location items to 'w' rather than 'W'
(Store_IDs 5 and 8)



XSL:
----

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>


<xsl:template match="/">
	<recordset>
		<xsl:apply-templates select="recordset/row">
			<xsl:sort select="@Location" data-type="text"
order="ascending" case-order="upper-first"/>
		</xsl:apply-templates>
	</recordset>
</xsl:template>

<xsl:template match="row">
	<row>
		<xsl:for-each select="@*">
			<xsl:attribute name="{name()}">
				<xsl:value-of select="."/>
			</xsl:attribute>
		</xsl:for-each>
	</row>
</xsl:template>


</xsl:stylesheet>


Now... I would expect to see the following result:

<?xml version="1.0" encoding="UTF-16"?>
<recordset>
   <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="10" Location="WA4138" />
   <row ReturnValue="0" Store_ID="11" Location="WA4139" />
   <row ReturnValue="0" Store_ID="5" Location="wA4131" />
   <row ReturnValue="0" Store_ID="8" Location="wA4136" />
</recordset>


Lower case 'w' items at the end.



However, what I am getting is:



<?xml version="1.0" encoding="UTF-16"?>
<recordset>
   <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" />
</recordset>


So it seems to be doing the sorting independently of the case and
then when it finds items with the same caracters, it sorts them
according to the case i.e. first upper-case then lower-case.



Is this the expected behaviour?
Is it me missing something here?



Thanks,
Yago

_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs.

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.