Subject: AW: [xsl] xsl:sort/@case-order feature missed From: "Nestel, Frank ISC 6" <nestefan@xxxxxxxxxx> Date: Thu, 31 Jan 2002 14:51:03 +0100 |
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 ä ) 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:choose> <xsl:when test="..."> <xsl:sort ...> </xsl:when> ... </xsl:choose> Such a control probably hurt the possibilty to avoid some runtime work by smart preprocessing of the stylesheet on first translation. Frank > -----Ursprüngliche Nachricht----- > Von: Jonathan Perret [mailto:jonathan@xxxxxxxxxxxx] > Gesendet am: Donnerstag, 31. Januar 2002 13:53 > An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Betreff: Re: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] just had a weird idea, Jonathan Perret | Thread | Re: [xsl] xsl:sort/@case-order feat, Jonathan Perret |
[xsl] just had a weird idea, Bryan Rasmussen | Date | [xsl] Passing parameters to xsl-sty, Ragulf Pickaxe |
Month |