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

Re: xsl:sort/@case-order feature missed

Subject: Re: xsl:sort/@case-order feature missed
From: "Jonathan Perret" <jonathan@xxxxxxxxxxxx>
Date: Thu, 31 Jan 2002 13:53:05 +0100
Re:  xsl:sort/@case-order feature missed
> we are missing a neutral value for the
> xsl:sort/@case-order. We are using a 
> 
> <xsl:sort ... case-order='{$which-order}'>
> 
> within a parametrized template and would like
> to have all three cases for which-order:
> 
> 1. lower-first
> 2. upper-first
> 3. no-particular-ordering-on-upper-and-lower
> 
> Since we are using xsl:variables we cannot simply
> leave the case-order attribute away.

Suggestion : have two <xsl:sort> elements for the same
key, but only "enable" one of the two depending on the
presence of a case order :

<xsl:variable
    name="has-order"
    select="$which-order='lower-first' or $which-order='upper-first'" />
<xsl:variable name="used-order">
    <xsl:choose>
        <xsl:when test="$has-order">
            <xsl:value-of select="$which-order" />
        </xsl:when>
    </xsl:choose>
    <xsl:otherwise>upper-first</xsl:otherwise>
</xsl:variable>
...
<xsl:sort
    select="...[$has-order]"
    case-order="{$used-order}">
<xsl:sort
    select="...[not($has-order]">

I think this will correctly handle any value of $which-order that isn't
a recognized case-order. You can get rid of $has-order if you say that
$which-order should be false() or the empty node-set when 
a case-neutral sort is desired.

Finally, I haven't checked the spec but Mike May's book says that
case-order's value when not specified is language-dependant.
I understand this to mean that case-order always has a value,
so if you are sorting the following sequence :

<elt val="A" />
<elt val="a" />
<elt val="A" />

and you don't specify a case-order, it will sort as either A,A,a
or a,A,A depending on the language; but not the document
order A,a,A as you seem to imply by
"no-particular-ordering-on-upper-and-lower"

I haven't tested this though so I may be totally wrong, or
it might be implementation-dependant.

Hope this helps.
--Jonathan



 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.