在通过javascript显示我的列表时遇到一些困难

在通过javascript显示我的列表时遇到一些困难,javascript,xml,xslt,Javascript,Xml,Xslt,我有schedule.xml,它包含所有游戏。我有一个转换battyleague.xsl。然后是Javascript文件library.js <xsl:template match="/Schedule"> <html> <head> <link href="batty.css" rel="stylesheet" type="text/css"/> </head> <

我有schedule.xml,它包含所有游戏。我有一个转换battyleague.xsl。然后是Javascript文件library.js

  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>
我可以得到胜利,失败,平局,然后按胜利排序显示。但我还需要一个下拉列表,显示个人的球队比赛日期、比赛主队、比赛客队以及比赛状态

  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>
我一直在四处寻找,并尝试了一些解决方案,但是我无法得到我想要使用的解决方案,无法工作。代码甚至没有显示一个简单的HTML选择下拉列表,我不知道为什么

  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>
我的XML:

<?xml-stylesheet type="text/xsl" href="battyleague1.xsl" ?>
<Schedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schedule.xsd" season="2013" >
    <Teams>
       <Team>Bluejays</Team>
    </Teams>
    <Teams>
       <Team>Mavericks</Team>
    </Teams>

     <Game status="Played">
       <Home_Team>Mavericks</Home_Team>
       <Away_Team>Bluejays</Away_Team>
       <Home_Team_Score>5</Home_Team_Score>
       <Away_Team_Score>3</Away_Team_Score>
       <Date>2014-03-12T09:00:00</Date>
     </Game>

      <Game status="Pending">
        <Home_Team>Bluejays</Home_Team>
        <Away_Team>Mavericks</Away_Team>
        <Home_Team_Score>0</Home_Team_Score>
        <Away_Team_Score>0</Away_Team_Score>
        <Date>2014-03-12T09:00:00</Date>
      </Game>
</Schedule>
  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>
再一次,我所要做的只是一个下拉列表,列出一个特定球队的所有比赛;显示以下列:

  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>
                        Team Select = Mavericks
  Status   Date                 Home_Team          Away_Team
  Played   2014-03-12T09:00:00  Mavericks          Bluejays
  Pending  2014-03-12T09:00:00  Bluejays           Mavericks
谢谢,
Gremmik82

对于初学者,我不会使用switch语句进行字符串比较。我不是说这会破坏你的代码,只是感觉不对劲。谢谢,我是javascript的初学者;坦白地说,我只是想做一些简单的事情,哈哈。我试着用JQuery,它可以让我做下拉列表;但它实际上并没有收集任何数据,而且还搞砸了球队的排名。不幸的是,如果我不使用switch语句,我甚至不知道从哪里开始。更让我担心的是,前面的文本没有显示:一次只解决一个问题。插入console.info“此处有一些信息”;输入代码并打开浏览器控制台以帮助调试程序
  <xsl:template match="/Schedule">
    <html>

      <head>
        <link href="batty.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
        <xsl:apply-templates />
        <xsl:call-template name="rankings"/>
        <script type="text/javascript" src="JScript.js"></script>
        <center>
          Select team name to see its schedule :
          <select id="team_name" onchange="notify();">
            <option value="none">--Select--</option>
            <option value="Bluejays">Bluejays</option>
            <option value="Huskers">Huskers</option>
            <option value="Mavericks">Mavericks</option>
            <option value="Lancers">Lancers</option>
            <option value="Stars">Stars</option>
            <option value="Storm">Storm</option>
          </select>

          <table border="0" id="tblBluejays" style="Display:none;">
            <caption>
              <b>Team Bluejays' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Bluejays' or Away_Team='Bluejays'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblHuskers" style="Display:none;">
            <caption>
              <b>Team Huskers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Huskers' or Away_Team='Huskers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblMavericks" style="Display:none;">
            <caption>
              <b>Team Mavericks' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Mavericks' or Away_Team='Mavericks'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblLancers" style="Display:none;">
            <caption>
              <b>Team Lancers' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Lancers' or Away_Team='Lancers'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStars" style="Display:none;">
            <caption>
              <b>Team Stars' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Stars' or Away_Team='Stars'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>

          <table border="0" id="tblStorm" style="Display:none;">
            <caption>
              <b>Team Storm' Schedule</b>
            </caption>
            <tr>
              <th bgcolor="#A4A4A4">Date</th>
              <th bgcolor="#A4A4A4">Home Team</th>
              <th bgcolor="#A4A4A4">Away Team</th>
              <th bgcolor="#A4A4A4">Status</th>
            </tr>
            <xsl:for-each select="/Schedule/Game">
              <xsl:if test="Home_Team='Storm' or Away_Team='Storm'">
                <tr>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Date"/>
                  </td>
                  <td align="center" bgcolor="#FF6600">
                    <xsl:value-of select="Home_Team"/>
                  </td>
                  <td align="center" bgcolor="#2E9AFE">
                    <xsl:value-of select="Away_Team"/>
                  </td>
                  <td align="center" bgcolor="#BFFF00">
                    <xsl:value-of select="Status"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="rankings">
    <table cellspacing="1" cellpadding="2" id="scores">
      <tr class="title">
        <th colspan="22">
          Season <xsl:value-of select="//Schedule/@season"/>
        </th>
      </tr>

      <tr class="fields">
        <th style="text-align: left">Team</th>
        <th>Wins</th>
        <th>Losses</th>
        <th>Ties</th>

      </tr>


    </table>
  </xsl:template>

  <xsl:template match="Team">

    <xsl:for-each select="Game">

           <xsl:sort select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])" data-type="number" order="ascending"/>

      <tr class="rankingTeams">
      <td style="text-align: left">




      </td>
      <td>

        <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &gt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &gt; Home_Team_Score])"/>



      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score &lt; Away_Team_Score]) 
            + count(//Game[@Status='Played'][Away_Team=current()][Away_Team_Score &lt; Home_Team_Score])"/>

      </td>
      <td>
                <xsl:value-of select="count(//Game[@Status='Played'][Home_Team=current()][Home_Team_Score = Away_Team_Score])"/>
      </td>

    </tr>
    </xsl:for-each>
  </xsl:template>
  <xsl:param name="teamId" />
  <xsl:template match="Teams">
    <h1>
      <xsl:for-each select="/Schedule/Game">
        <xsl:if test="Home_Team=Team[$teamId] or Away_Team=Team[$teamId]">
          <tr>
            <td align="center">
              <xsl:value-of select="Date"/>
            </td>
            <td align="center">
              <xsl:value-of select="Home_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Away_Team"/>
            </td>
            <td align="center">
              <xsl:value-of select="Status"/>
            </td>
          </tr>
        </xsl:if> 
      </xsl:for-each>

    </h1>
  </xsl:template>
  <xsl:template match="Game">

  </xsl:template>

</xsl:stylesheet>