You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2004/01/27 12:22:51 UTC

DO NOT REPLY [Bug 24583] - muenchian grouping + sorting with strange effects

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24583>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24583

muenchian grouping + sorting with strange effects





------- Additional Comments From mats.noren@curalia.se  2004-01-27 11:22 -------
I wonder if this is what happens to me with the following stylesheet:

I have a couple of keys defined like:

<xsl:key name="items-by-type" match="/page/result/item" use="type"/>
<xsl:key name="items-by-location" match="/page/result/item" use="location"/>

<xsl:key name="types-by-id" match="type" use="@id"/>
<xsl:key name="locations-by-letter" match="location" use="letter"/>

and a template with the following:
...
...
<xsl:for-each select="item[count(.|key('items-by-location',location)[1])=1]">
   <xsl:variable name="location" select="location"/>
   <xsl:variable name="pos" select="position()"/>
      <div class="menutitle">
         <xsl:for-each select="$constants">
            <xsl:variable name="rubrik" select="key('locations-by-
letter',$location)/name"/>
            <xsl:if test="boolean(normalize-space($rubrik))">
               <h2 class="resultHeader">
                  <img src="img/ruta_gold.gif" class="navigator" alt="" 
border="0"/>
                  <a href="javascript:" title="{$rubrik}" onclick="SwitchMenu
('sub{$pos}')">
                     <xsl:value-of select="$rubrik"/>
                  </a>
               </h2>
            </xsl:if>
         </xsl:for-each>
      </div>
      <span class="submenu" id="sub{position()}">
         <!-- process all items having the current location  -->
         <xsl:for-each select="key('items-by-location',location)">
            <xsl:sort select="title" data-type="text" order="ascending"/>
               <p class="result"><a href="javascript:" onClick="top.showPage
('{url}');"><xsl:attribute name="title"><xsl:value-of 
select="title"/></xsl:attribute><xsl:value-of select="title"/></a></p>
         </xsl:for-each>
      </span>
      <div><img src="img/resultSeparator.gif" width="180" height="1" alt="" 
border="0" class="resultSeparator"/></div>
</xsl:for-each>
....

For some reason the same template without the xsl:sort element groups the 
result based on the type element and removes duplicates like intended.
With the xsl:sort element on the inner "for-each"-element the duplicates 
appear on the outer "for-each"-loop. And breaks the muenchian grouping... :(