Re: [xsl] Re: Using XSL for a "world records" table

Subject: Re: [xsl] Re: Using XSL for a "world records" table
From: Ryan Heise <rheise@xxxxxxxxxxxxx>
Date: Sun, 18 May 2003 16:25:45 +1000
On Sun, May 18, 2003 at 07:51:57AM +0200, Dimitre Novatchev wrote:
> > - notice in the existing records page that two people are tied for first
> >   place. In this case, they should both have "1" in the "Place" column.
> >   My current approach fails: when I sort on the time column and use the
> >   value of position() for place, it unfairly gives one of them second
> >   place. Is there another way?
> 
> Yes, it is called grouping. You can learn more about the Muenchian method
> for grouping at:
> http://www.jenitennison.com/xslt/grouping/index.html

Thanks Dimitre. It almost works with grouping, but now the record in 3rd
place is listed as 2nd place. That is:

Place   Time         Name
1       11 seconds   Person 1
1	11 seconds   Person 2
2       12 seconds   Person 3

My code looks like this:

<xsl:for-each select="record[count(. | key('records-by-time', time)[1]) = 1]">
 <xsl:sort data-type="number" select="time"/>
 <xsl:apply-templates select="key('records-by-time', time)">
  <xsl:with-param name="place" select="position()"/>
 </xsl:apply-templates>
</xsl:for-each>

As you see, I'm using the value of position() for place. 

Do you know of any way to get around this?

> I use the datetime_lib.xsl library, distributed with Xselerator (you can
> just download the trial version).
> 
> A long time ago I wrote an XSLT Calendar application using this library -- 
> this can be obtained at:
> 
> http://www.topxml.com/code/default.asp?p=3&id=v20020711152545

Thanks, I'll have a look at it!

Ryan

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread