|
From: <rga...@us...> - 2002-11-02 16:54:36
|
Update of /cvsroot/csms/csms-core/src/resources/conf
In directory usw-pr-cvs1:/tmp/cvs-serv7768
Modified Files:
ScoringConfig.xsl
Log Message:
Fixed problem of picking up the wrong player from players.xml (bug 629932)
Fixed problem with conceeding goal points being deducted (bug 632605)
Index: ScoringConfig.xsl
===================================================================
RCS file: /cvsroot/csms/csms-core/src/resources/conf/ScoringConfig.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ScoringConfig.xsl 28 Oct 2002 13:54:22 -0000 1.1
--- ScoringConfig.xsl 2 Nov 2002 16:54:31 -0000 1.2
***************
*** 15,20 ****
<xsl:output method="text/xml"/>
- <!-- fixme the following pathname should be an URL -->
<xsl:variable name="playersDataSource">http://www.fanfoot.com/test/players.xml</xsl:variable>
<!-- match everything not match elsewhere and do nothing with it! -->
--- 15,20 ----
<xsl:output method="text/xml"/>
<xsl:variable name="playersDataSource">http://www.fanfoot.com/test/players.xml</xsl:variable>
+ <xsl:variable name="teamDataSource">http://www.fanfoot.com/test/teams.xml</xsl:variable>
<!-- match everything not match elsewhere and do nothing with it! -->
***************
*** 76,83 ****
--- 76,90 ----
<xsl:for-each select="//event[type='teamStarter'] | //event[type='substituteStarter']">
<xsl:variable name="playerSurname"><xsl:value-of select="./player"/></xsl:variable>
+ <xsl:variable name="teamCommonName"><xsl:value-of select="./team"/></xsl:variable>
+ <xsl:variable name="teamID">
+ <xsl:call-template name="getTeamID">
+ <xsl:with-param name="commonName"><xsl:value-of select="$teamCommonName"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
<xsl:variable name="playerName">
<xsl:call-template name="getPlayerFullName">
<xsl:with-param name="playerSurname"><xsl:value-of select="$playerSurname"/></xsl:with-param>
+ <xsl:with-param name="teamID"><xsl:value-of select="$teamID"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
***************
*** 119,126 ****
<xsl:for-each select="//event[type='teamStarter'] | //event[type='substituteStarter']">
<xsl:variable name="currentTeam"><xsl:value-of select="team"/></xsl:variable>
!
<xsl:variable name="playerFullName">
<xsl:call-template name="getPlayerFullName">
<xsl:with-param name="playerSurname"><xsl:value-of select="player"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
--- 126,138 ----
<xsl:for-each select="//event[type='teamStarter'] | //event[type='substituteStarter']">
<xsl:variable name="currentTeam"><xsl:value-of select="team"/></xsl:variable>
! <xsl:variable name="teamID">
! <xsl:call-template name="getTeamID">
! <xsl:with-param name="commonName"><xsl:value-of select="$currentTeam"/></xsl:with-param>
! </xsl:call-template>
! </xsl:variable>
<xsl:variable name="playerFullName">
<xsl:call-template name="getPlayerFullName">
<xsl:with-param name="playerSurname"><xsl:value-of select="player"/></xsl:with-param>
+ <xsl:with-param name="teamID"><xsl:value-of select="$teamID"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
***************
*** 230,268 ****
<xsl:variable name="goalMinutes"><xsl:value-of select="normalTimeMinutes"/></xsl:variable>
! <xsl:variable name="scoringTeam">
<xsl:call-template name="getPlayerTeam">
<xsl:with-param name="playerFullName"><xsl:value-of select="player"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
!
!
! <xsl:for-each select="//event[type='teamStarter'] | //event[type='substituteStarter']">
<xsl:variable name="playerFullName">
<xsl:call-template name="getPlayerFullName">
<xsl:with-param name="playerSurname"><xsl:value-of select="player"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
!
! <xsl:variable name="playerTeam">
! <xsl:call-template name="getPlayerTeam">
! <xsl:with-param name="playerSurname"><xsl:value-of select="player"/></xsl:with-param>
! </xsl:call-template>
! </xsl:variable>
!
<xsl:choose>
<xsl:when test="starts-with($scoringTeam, 'ERROR')">
<error>
! <xsl:value-of select="concat('Unable to deduct conceeded goal points becuase cannot identify scoring team (', $scoringTeam, ')')"/>
! </error>
! </xsl:when>
!
! <xsl:when test="starts-with($playerTeam, 'ERROR')">
! <error>
! <xsl:value-of select="concat('Unable to deduct conceeded goal points becuase cannot identify scoring team (', $playerTeam, ')')"/>
</error>
</xsl:when>
! <xsl:when test="$playerTeam != $scoringTeam">
<!-- get player start time -->
<xsl:variable name="onMinutes">
--- 242,296 ----
<xsl:variable name="goalMinutes"><xsl:value-of select="normalTimeMinutes"/></xsl:variable>
! <xsl:variable name="scoringTeamID">
<xsl:call-template name="getPlayerTeam">
<xsl:with-param name="playerFullName"><xsl:value-of select="player"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
!
! <xsl:variable name="scoringTeam">
! <xsl:call-template name="getTeamName">
! <xsl:with-param name="teamID"><xsl:value-of select="$scoringTeamID"/></xsl:with-param>
! </xsl:call-template>
! </xsl:variable>
!
! <xsl:variable name="conceedingTeam">
! <xsl:choose>
! <xsl:when test="//event[type='result']/homeTeam = $scoringTeam">
! <xsl:value-of select="//event[type='result']/awayTeam"/>
! </xsl:when>
! <xsl:otherwise>
! <xsl:value-of select="//event[type='result']/homeTeam"/>
! </xsl:otherwise>
! </xsl:choose>
! </xsl:variable>
!
! <xsl:variable name="conceedingTeamID">
! <xsl:call-template name="getTeamID">
! <xsl:with-param name="commonName"><xsl:value-of select="$conceedingTeam"/></xsl:with-param>
! </xsl:call-template>
! </xsl:variable>
!
! <xsl:for-each select="//event[type='teamStarter' and team=$conceedingTeam] | //event[type='substituteStarter' and team=$conceedingTeam]">
<xsl:variable name="playerFullName">
<xsl:call-template name="getPlayerFullName">
<xsl:with-param name="playerSurname"><xsl:value-of select="player"/></xsl:with-param>
+ <xsl:with-param name="teamID"><xsl:value-of select="$conceedingTeamID"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
!
<xsl:choose>
<xsl:when test="starts-with($scoringTeam, 'ERROR')">
<error>
! <xsl:value-of select="concat('Unable to deduct conceeded goal points from ', $playerFullName, ' of ', $conceedingTeam, ' because cannot identify scoring team (', $scoringTeam, ')')"/>
</error>
</xsl:when>
! <xsl:when test="starts-with($playerFullName, 'ERROR')">
! <error>
! <xsl:value-of select="concat('Unable to deduct goalkeepers/defenders conceeding points for ', $playerFullName, ' of ', $conceedingTeam)"/>
! </error>
! </xsl:when>
+ <xsl:otherwise>
<!-- get player start time -->
<xsl:variable name="onMinutes">
***************
*** 291,298 ****
</xsl:choose>
</xsl:variable>
!
<!-- test to see if the player was on the pitch when the goal was scored -->
! <xsl:if test="$offMinutes != 'Did Not Play'">
! <xsl:if test="$goalMinutes < $offMinutes and $goalMinutes > onMinutes">
<xsl:variable name="playerPosition">
<xsl:call-template name="getPlayerPosition">
--- 319,326 ----
</xsl:choose>
</xsl:variable>
!
<!-- test to see if the player was on the pitch when the goal was scored -->
! <xsl:if test="$onMinutes != 'Did Not Play'">
! <xsl:if test="$goalMinutes < $offMinutes and $goalMinutes > $onMinutes">
<xsl:variable name="playerPosition">
<xsl:call-template name="getPlayerPosition">
***************
*** 300,309 ****
</xsl:call-template>
</xsl:variable>
!
<xsl:choose>
<xsl:when test="$playerPosition = 'Goalkeeper'">
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$playerTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Goalkeeper Conceeded Goal</xsl:with-param>
--- 328,337 ----
</xsl:call-template>
</xsl:variable>
!
<xsl:choose>
<xsl:when test="$playerPosition = 'Goalkeeper'">
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$conceedingTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Goalkeeper Conceeded Goal</xsl:with-param>
***************
*** 313,317 ****
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$playerTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Full Back Conceeded Goal</xsl:with-param>
--- 341,345 ----
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$conceedingTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Full Back Conceeded Goal</xsl:with-param>
***************
*** 321,325 ****
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$playerTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Centre Back Conceeded Goal</xsl:with-param>
--- 349,353 ----
<xsl:call-template name="getPointsNode">
<xsl:with-param name="playerName"><xsl:value-of select="$playerFullName"/></xsl:with-param>
! <xsl:with-param name="playersTeam"><xsl:value-of select="$conceedingTeam"/></xsl:with-param>
<xsl:with-param name="points">-1</xsl:with-param>
<xsl:with-param name="eventType">Centre Back Conceeded Goal</xsl:with-param>
***************
*** 332,336 ****
<xsl:otherwise>
<error>
! <xsl:value-of select="concat('Unable to determine player position to deduct conceeded goal points (', $playerFullName, ' of ', $playerTeam, ')')"/>
</error>
</xsl:otherwise>
--- 360,364 ----
<xsl:otherwise>
<error>
! <xsl:value-of select="concat('Unable to determine player position to deduct conceeded goal points (', $playerFullName, ' of ', $conceedingTeam, ')')"/>
</error>
</xsl:otherwise>
***************
*** 338,344 ****
</xsl:if>
</xsl:if>
! </xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
--- 366,377 ----
</xsl:if>
</xsl:if>
! </xsl:otherwise>
</xsl:choose>
+
+
</xsl:for-each>
+
+
+
</xsl:for-each>
</xsl:template>
***************
*** 368,383 ****
</xsl:template>
! <!-- Return the full player name -->
<xsl:template name="getPlayerFullName">
<xsl:param name="playerSurname"/>
<xsl:variable name="playerFirstName">
! <xsl:value-of select="document($playersDataSource)/players/player[surname=$playerSurname]/firstName[@type='main']"/>
</xsl:variable>
!
<!-- Return the result -->
<xsl:choose>
<xsl:when test="string-length($playerFirstName) > 0"><xsl:value-of select="concat($playerFirstName, ' ', $playerSurname)"/></xsl:when>
! <xsl:otherwise><xsl:value-of select="concat('ERROR: Unknown Player (', $playerSurname, ')')"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
--- 401,447 ----
</xsl:template>
! <!-- Return team ID given the teams common name -->
! <xsl:template name="getTeamID">
! <xsl:param name="commonName"/>
!
! <xsl:variable name="teamID">
! <xsl:value-of select="document($teamDataSource)/teams/team[commonName=$commonName]/@id"/>
! </xsl:variable>
!
! <!-- Return the result -->
! <xsl:choose>
! <xsl:when test="string-length($teamID) > 0"><xsl:value-of select="$teamID"/></xsl:when>
! <xsl:otherwise><xsl:value-of select="concat('ERROR: Unknown Team (', $commonName, ')')"/></xsl:otherwise>
! </xsl:choose>
! </xsl:template>
!
! <!-- Return team common name given the teams id -->
! <xsl:template name="getTeamName">
! <xsl:param name="teamID"/>
!
! <xsl:variable name="teamName">
! <xsl:value-of select="document($teamDataSource)/teams/team[@id=$teamID]/commonName"/>
! </xsl:variable>
!
! <!-- Return the result -->
! <xsl:choose>
! <xsl:when test="string-length($teamName) > 0"><xsl:value-of select="$teamName"/></xsl:when>
! <xsl:otherwise><xsl:value-of select="concat('ERROR: Unknown Team (', $teamID, ')')"/></xsl:otherwise>
! </xsl:choose>
! </xsl:template>
!
! <!-- Return the full player name, given the surname and team ID -->
<xsl:template name="getPlayerFullName">
<xsl:param name="playerSurname"/>
+ <xsl:param name="teamID"/>
<xsl:variable name="playerFirstName">
! <xsl:value-of select="document($playersDataSource)/players/player[surname=$playerSurname and team=$teamID]/firstName[@type='main']"/>
</xsl:variable>
!
<!-- Return the result -->
<xsl:choose>
<xsl:when test="string-length($playerFirstName) > 0"><xsl:value-of select="concat($playerFirstName, ' ', $playerSurname)"/></xsl:when>
! <xsl:otherwise><xsl:value-of select="concat('ERROR: Unknown Player (', $playerSurname, ' of ', $teamID, ')')"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
|