<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>5324</bug_id>
          
          <creation_ts>2007-12-17 00:12:16 +0000</creation_ts>
          <short_desc>[XSLT 2.0] case-order is not clearly described</short_desc>
          <delta_ts>2008-07-29 08:10:59 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 2.0</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>colin</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>18108</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-12-17 00:12:16 +0000</bug_when>
    <thetext>Bug #791 (member-only) against the XSLT test suite points out that case-order on xsl:sort is not clearly described.

The sum total of the description is: &quot;The case-order attribute indicates whether the desired collation should sort upper-case letters before lower-case or vice versa. The effective value of the attribute must be either lower-first (indicating that lower-case letters precede upper-case letters in the collating sequence) or upper-first (indicating that upper-case letters precede lower-case).&quot;

As the bug report against the test suite points out, this could be read as indicating that case-order=&quot;lower-first&quot; is supposed to mean that lower-case &quot;z&quot; precedes upper-case &quot;A&quot; in the collating sequence. I do not think this is the intent. The intent was stated (not especially well) by example in the XSLT 1.0 specification:

For example, if lang=&quot;en&quot;, then A a B b are sorted with case-order=&quot;upper-first&quot; and a A b B are sorted with case-order=&quot;lower-first&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18110</commentid>
    <comment_count>1</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2007-12-17 13:53:17 +0000</bug_when>
    <thetext>Note that there are additional considerations that need be taken into account when formulating a clear specification for the beahviour. Such as:

1) Which case mappings are to be used? My guess is that the default Unicode legacy mappings would be appropriate (strings don&apos;t change length). In which case German S SHARP (I think that&apos;s the Unicode name) won&apos;t have any cased version.
2) What happens to title-cased letters?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18653</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-01-31 18:11:13 +0000</bug_when>
    <thetext>In response to comment #1, I don&apos;t think we need to go into that level of detail. We describe case-order (like lang) as requesting use of a collation with certain characteristics, and we can describe this in terms of a property, for example that

for every string S, compare(lower-case(S), upper-case(S), $coll) &lt; 1

without prescribing every detail of the collation&apos;s behaviour. An example of a collation that has this property is one that sorts 

pole, Pole, polish, Polish </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19447</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-03-13 16:01:18 +0000</bug_when>
    <thetext>In action A-2008-02-07-005 I was asked to produce text to fix this.

The current text is:

The case-order attribute indicates whether the desired collation should sort upper-case letters before lower-case or vice versa. The effective value of the attribute must be either lower-first (indicating that lower-case letters precede upper-case letters in the collating sequence) or upper-first (indicating that upper-case letters precede lower-case).

Proposal: Add after the existing text. &quot;When lower-first is requested, the returned collation SHOULD have the property that for any string S, lower-case(S) collates before upper-case(S); when upper-first is requested, the returned collation SHOULD have the property that for any string S, upper-case(S) collates before lower-case(S). When case of letters is a tertiary characteristic, as in the Unicode Collation Algorithm, choosing upper-first will have the effect that, for example, StAndrew collates after Stand but before Standrew.&quot; </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19471</commentid>
    <comment_count>4</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2008-03-14 07:34:56 +0000</bug_when>
    <thetext>The proposed text still seems to suggest (to me) that, for upper first, Z should collate before a and, for lower first, z should collate before A.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19472</commentid>
    <comment_count>5</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2008-03-14 07:52:38 +0000</bug_when>
    <thetext>I propose to change the text:

&quot;The case-order attribute indicates whether the desired collation should sort
upper-case letters before lower-case or vice versa. The effective value of the
attribute must be either lower-first (indicating that lower-case letters
precede upper-case letters in the collating sequence) or upper-first
(indicating that upper-case letters precede lower-case).&quot;

to:

&quot;The case-order attribute indicates whether the desired collation should sort
upper-case variants of a letter before their lower-case variants or vice versa. The effective value of the
attribute must be either lower-first (indicating that the lower-case variant of a letter
precedes  the upper-case variant of the same letter in the collating sequence) or upper-first
(indicating that the upper-case variant of a letter precedes the lower-case variant). If the letter has an additional title-case variant, then that should be treated as if it were an ypper-case variant with respect to the lower-case variant&quot;
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19557</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-03-20 11:49:10 +0000</bug_when>
    <thetext>In action A2008-03-13-003 I was asked to try again.

Proposal: Add after the existing text. &quot;When lower-first is requested, the
returned collation SHOULD have the property that when two strings differ only in the case of one or more characters, then a string in which the first differing character is lower-case should precede a string in which the corresponding character is title-case, which should in turn precede a string in which the corresponding character is upper-case. When upper-first is requested, the
returned collation SHOULD have the property that when two strings differ only in the case of one or more characters, then a string in which the first differing character is upper-case should precede a string in which the corresponding character is title-case, which should in turn precede a string in which the corresponding character is lower-case.&quot;

For example, if lower-first is requested, then a sorted sequence might be &quot;MacAndrew, macintosh, macIntosh, Macintosh, MacIntosh, macintoshes, Macintoshes, McIntosh&quot;. If upper-first is requested, the same sequence would sort as &quot;MacAndrew, MacIntosh, Macintosh, macIntosh, macintosh, MacIntoshes, macintoshes, McIntosh&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21128</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-07-10 16:43:17 +0000</bug_when>
    <thetext>It was agreed on 10 Jul 2008 to use the text in comment #6 but reinstating the XSLT 1.0 example (A a B b) for additional clarity.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21213</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-07-17 14:12:52 +0000</bug_when>
    <thetext>Erratum E26 has been drafted.

Colin, as the person who effectively raised this problem (as a bug against the test suite), I would be grateful if you would close it if you are satisfied.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21363</commentid>
    <comment_count>9</comment_count>
    <who name="Colin Adams">colin</who>
    <bug_when>2008-07-29 08:10:59 +0000</bug_when>
    <thetext>Closed as requested.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>