Re: [xsl] Trouble using xsl:key under XSL 1.0

Subject: Re: [xsl] Trouble using xsl:key under XSL 1.0
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Thu, 13 Dec 2007 11:13:46 +0800
On 12 13, 07, at 10:56 AM, Gareth Howells wrote:

<xsl:for-each select="//results">

<xsl:variable name="week" select="@week" />

<xsl:key name="playerResultLookupByWeek" match="playerResult[../ @week=$week]" use="@player" />

Haven't checked the whole code, but an xsl:key element must be a a child of an xsl:stylesheet or xsl:transform. this is not be a valid template. Try placing it outside the template match maybe you can make your code work.

<p> Week <xsl:value-of select="substring(@week,2,1)" /> </p>

<xsl:for-each select="//teams/team">

Team <xsl:value-of select="name" /> scored a total of <xsl:value-of select="
(sum(key('playerResultLookupByWeek',//teams/team[name=current()/ name]/teamPlayers/teamPlayer)/g) * $gPoints)
(sum(key('playerResultLookupByWeek',//teams/team[name=current()/ name]/teamPlayers/teamPlayer)/a) * $aPoints)
(sum(key('playerResultLookupByWeek',//teams/team[name=current()/ name]/teamPlayers/teamPlayer)/gda) * $gdaPoints)
(sum(key('playerResultLookupByWeek',//teams/team[name=current()/ name]/teamPlayers/teamPlayer)/gdcs) * $gdcsPoints)
(sum(key('playerResultLookupByWeek',//teams/team[name=current()/ name]/teamPlayers/teamPlayer)/gdga) * $gdgaPoints)
"/> points this week



Jeferson L. Sese jsese at asiatype dot com Asiatype Incorporated Suite 114 Columbia Tower, Ortigas Ave. Greenhills, Mandaluyong City 1550 Philippines

Current Thread