xsl-list
[Top] [All Lists]

Re: Grouping and calculating a score list

2006-02-14 03:21:30





Hi,
     Please use this stylesheet.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
    <xsl:output method="html" indent="yes" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

    <xsl:key name="players-by-id" match="match/player" use="@id"/>


    <xsl:strip-space elements="*"/>
    <xsl:variable name="playerDoc"
select="document('T3Crew_Players.xml')"/>


    <xsl:template match="/">
        <html>
            <body>
                <h2>T3Crew - Hall of Fame<br/>(after <xsl:value-of
select="count(T3Crew/results)"/> Evevnings)</h2>
                <xsl:apply-templates select="T3Crew"/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="T3Crew">
        <xsl:call-template name="displayPlayerSummary">
            <xsl:with-param name="tableID" select="'results_HOF'"/>
        </xsl:call-template>
        <xsl:apply-templates select="results"/>
    </xsl:template>

    <xsl:template match="results">
        <hr/>
        <h2>Result from  <xsl:value-of select="@date"/>    </h2>
        <xsl:call-template name="displayPlayerSummary">
            <xsl:with-param name="tableID" select="concat('results_' ,
@date)"/>
            <xsl:with-param name="playerList" select="./match/player"/>

        </xsl:call-template>
    </xsl:template>

    <xsl:template name="displayPlayerSummary">
        <xsl:param name="tableID" select="'tableID'"/>
        <xsl:param name="playerList" select="//match/player"/>

        <table class="sortable" id="{$tableID}">
        <tbody>
            <tr>
                <!--<th>Platz</th>-->
                <th>Name</th>
                <th># Matches</th>
                <th>Score</th>
            </tr>

      <xsl:for-each select="$playerDoc/players/player">

            <xsl:variable name="id" select="@id"/>
            <xsl:variable name="player" select="."/>

            <tr>
                <!--<td>&#160;</td>-->
                <td><xsl:value-of select="$playerDoc/players/player[(_at_)id =
$id]/@aka"/></td>


      <td class="number"><xsl:value-of
select="count($playerList[(_at_)id=$id])"/></td>
        <td class="number"><xsl:value-of select="count($playerList[(_at_)id=$id
and @score &gt; 10])"/></td>

            </tr>

            </xsl:for-each>


      </tbody>
        </table>
    </xsl:template>
    </xsl:stylesheet>


cheers,
prakash


This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to 
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its 
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--