<?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>8398</bug_id>
          
          <creation_ts>2009-11-29 14:10:29 +0000</creation_ts>
          <short_desc>[XSLT 2.0] order in result of grouping example is wrong</short_desc>
          <delta_ts>2010-07-15 09:35:38 +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>http://www.w3.org/TR/xslt20/#grouping-examples</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="Martin Honnen">martin.honnen</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>29780</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Honnen">martin.honnen</who>
    <bug_when>2009-11-29 14:10:29 +0000</bug_when>
    <thetext>The example &quot;Grouping Nodes based on Common Values&quot; in http://www.w3.org/TR/xslt20/#grouping-examples shows the following result:

&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Position&lt;/th&gt;
    &lt;th&gt;Country&lt;/th&gt;
    &lt;th&gt;List of Cities&lt;/th&gt;
    &lt;th&gt;Population&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;Italia&lt;/td&gt;
    &lt;td&gt;Milano, Venezia&lt;/td&gt;
    &lt;td&gt;6&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;France&lt;/td&gt;
    &lt;td&gt;Lyon, Paris&lt;/td&gt;
    &lt;td&gt;9&lt;/td&gt;
  &lt;/tr&gt;  
  &lt;tr&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;Deutschland&lt;/td&gt;
    &lt;td&gt;München&lt;/td&gt;
    &lt;td&gt;4&lt;/td&gt;
  &lt;/tr&gt;  
&lt;/table&gt;

I think the order in the third cell (List of Cities) in the third row (key France) is wrong, it should be &quot;Paris, Lyon&quot;, not &quot;Lyon, Paris&quot;, as in the input

  &lt;city name=&quot;Milano&quot;  country=&quot;Italia&quot;      pop=&quot;5&quot;/&gt;
  &lt;city name=&quot;Paris&quot;   country=&quot;France&quot;      pop=&quot;7&quot;/&gt;
  &lt;city name=&quot;München&quot; country=&quot;Deutschland&quot; pop=&quot;4&quot;/&gt;
  &lt;city name=&quot;Lyon&quot;    country=&quot;France&quot;      pop=&quot;2&quot;/&gt;
  &lt;city name=&quot;Venezia&quot; country=&quot;Italia&quot;      pop=&quot;1&quot;/&gt;

city name=&quot;Paris&quot; precedes city name=&quot;Lyon&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29790</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-11-30 11:14:07 +0000</bug_when>
    <thetext>I think one could defend the example on the grounds that the stated requirement is for the output to be &quot;unsorted&quot;, i.e. the user does not care what the result order is, and the provided code meets this requirement. However I agree it would be clearer if the published code delivered the published output as shown.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29804</commentid>
    <comment_count>2</comment_count>
    <who name="Martin Honnen">martin.honnen</who>
    <bug_when>2009-11-30 17:57:34 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I think one could defend the example on the grounds that the stated requirement
&gt; is for the output to be &quot;unsorted&quot;, i.e. the user does not care what the result
&gt; order is, and the provided code meets this requirement. However I agree it
&gt; would be clearer if the published code delivered the published output as shown.

When I filed this &quot;bug&quot; I had focused on the sample input, output, and XSLT code in the specification. Based on your comment I reread the text accompanying the example again and see that it says &quot;The four columns are to contain [...] third, a comma-separated alphabetical list of the city names within that country&quot;. That means the order &quot;Lyon, Paris&quot; is what the textual description specifies, an alphabetical list. Only in that case the XSLT sample does not achieve what the textual description requires, as it outputs &quot;Paris, Lyon&quot;.

So somehow the textual description, the sample output and the sample XSLT code need to be aligned.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35855</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-05-27 16:39:36 +0000</bug_when>
    <thetext>Decided to fix this by adding the required xsl:sort element to the XSLT
solution of the example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>36896</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-07-15 09:35:38 +0000</bug_when>
    <thetext>This will be erratum E47. I am closing the bug anticipating that this resolution is acceptable.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>