Page 1 of 1

Count the number of times a player plays a game in a different difficulty level

Posted: Thu Oct 13, 2016 8:09 pm
by Azzo
I have a xml and xslt files like below. And Im showing in a table the gamename and the player name. But now Im trying to do one thing and Im not see how.

I want to show how many times a player played a game in a novice, easy, medium, hard, legend level and the total. For example I want each row like this:

GameName | Player Name | NoviceLevels | EasyLevels | MediumLevels | HardLevels | Total

Game Title 1 John 1 1 0 0 2
I already try a lot of alternatives but Im not having success put this working like this. Do you see how to achieve this?

This is the xml:

Code: Select all

    <gamename>GameTitle 1</gamename>

This is the XSL:

Code: Select all

<xsl:for-each select="//games">
<xsl:for-each select="game">
   <td><xsl:value-of select="gamename"/></td>
   <td><xsl:value-of select="players/player/playername"/></td>

What I have is here:

What Im trying now is here:

Do you know if its possible do this with xsl and what is missing in