|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Sorting Upper-Case first. Microsoft bug?
Hi Yago,
i just found that MSXML 4.0 is respecting case-order
attribute for xsl:sort . It is producing output as
mentioned in the spec, and as you have written below.
The output you are getting is *correct* (i.e. what is
defined in the spec). *There are integers in the
Location attribute values which make you feel sorted
output is wrong*. Please try putting simple values for
e.g. b, B, a, A etc. as Location values and you will
be able to observe the correct result..
Regards,
Mukul
--- Yago Alvarado <Yago.Alvarado@xxxxxxxxxxxxxx>
wrote:
> 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
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
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
|

Cart








