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

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

Subject: AW: xsl:sort/@case-order feature missed
From: "Nestel, Frank ISC 6" <nestefan@xxxxxxxxxx>
Date: Thu, 31 Jan 2002 14:51:03 +0100
xsl sort case
Thanks Jonathan for your reply.

I'm not sure if I understand your suggestions. Well, maybe
I understand but didn't like what you meant :-)

1. When it comes to our application, I could use something
like "sort, but use document order as tiebreak" instead of
specifying a case order explicitely or implicitely (by
some default). If this order does not exist, I could use
it. Maybe we have to create an extra sort attribute or so.
But this is ugly. As I understand Michael Kay in his book,
he claimes that case order depends on the actual publication,
not only on language. What depends on language is the way
the letters themselves are collated (he gives an example
about the rules for German/Swedish &auml; ) In my eyes the
XSLT standard of w3c is not entirely explicit in this respect.
But this might be my lacking sense of fine grained English.
In XSLT 2 it all depends how to read "case-order effective value"
in the situation where no case-order is present. I didn't understand 
yet the new collation attribute in XSLT 2 and whether this could 
provide a solution to my problem:

2. Of course one could keep two sort statements. The problem 
I had only arrose, cause we had a stack of named templates 
which were all them same, but differed in that little case-ordering, 
so duplication does not only involve duplication of two simple 
xsl:sort elements but restructuring and duplication of some part 
of a template call hierarchy. We just wanted to avoid that sheer 
uglyness. Unfortunately there is no way of doing s.th. like
		<xsl:when test="...">
			<xsl:sort ...>
Such a control probably hurt the possibilty to avoid some
runtime work by smart preprocessing of the stylesheet on
first translation.


> -----Ursprüngliche Nachricht-----
> Von: Jonathan Perret [mailto:jonathan@xxxxxxxxxxxx]
> Gesendet am: Donnerstag, 31. Januar 2002 13:53
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: 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

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

Current Thread


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.
First Name
Last Name
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.