<?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>2916</bug_id>
          
          <creation_ts>2006-02-22 18:16:36 +0000</creation_ts>
          <short_desc>[XSLT] Which key is the grouping key for the group</short_desc>
          <delta_ts>2006-03-13 11:10:44 +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>Candidate Recommendation</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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="Joanne Tong">joannet</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <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>8385</commentid>
    <comment_count>0</comment_count>
    <who name="Joanne Tong">joannet</who>
    <bug_when>2006-02-22 18:16:37 +0000</bug_when>
    <thetext>Consider this example,

&lt;xsl:for-each-group select=&quot;xs:float(1.0),1.0000000000100000000001,xs:double
(1.00000000001)&quot; group-adjacent=&quot;.&quot;&gt;
   &lt;xsl:value-of select=&quot;current-grouping-key() instance of xs:float&quot;/&gt;
&lt;/xsl:for-each-group&gt;

The grouping keys for each adjacent pair of items are equal using the eq 
operator, so all the values are in the same group.  However, the description 
of the group-adjacent attribute does not make it clear which of the three 
grouping keys is the grouping key for the group.

The description of the group-by attribute contains an algorithm that would 
make the key of the initial item to be the grouping key of its group.  

I suggest adding explicit text in the description of the group-adjacent 
attribute (and maybe even the group-by attribute) that the key of the initial 
item should be the group key of its group.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8672</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-03-10 21:27:46 +0000</bug_when>
    <thetext>The WG considered this on 9 March 2006 and decided:

(a) the grouping key should be the value as it appears on the first item in the group

(b) however, if the grouping key was an untyped atomic value and was converted to a string, the value of current-grouping-key() is the string, not the untyped atomic value.

The editorial changes to implement this decision have not yet been made so the status is set to FIXED but not CLOSED.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8699</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-03-13 11:10:44 +0000</bug_when>
    <thetext>The changed text to implement this decision is as follows:

In the definition of grouping key (immediately after XTSE1090) change: &quot;The grouping key is the value of the expression contained in the group-by attribute or group-adjacent attribute.&quot; to &quot;The grouping keys are the items in the sequence obtained by evaluating the expression contained in the group-by attribute or group-adjacent attribute, atomizing the result, and then casting any xs:untypedAtomic values to xs:string.&quot;

In 14.2 (current-grouping-key function) add after the third para.

Although the grouping keys of all items in the group are by definition equal, they are not necessarily identical. For example, one might be an xs:float while another is an xs:decimal. The current-grouping-key() function is defined to return the grouping key of the *initial item* in the group, after atomization and casting of xs:untypedAtomic to xs:string.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>