Help with an xsl for a beginner

admin

Administrator
Staff member
Hello,

I would appreciate any help on the below xsl. It displays the header and first row correctly but the 2nd roll does not show up. It I believe it is failing for the loop at <xsl:for-each select="Stats/Player"/> It does validate and is well formed.

I posted the xsl and xml

<?xml version="1.0" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<h2>Player Stats</h2>
<table border="5">
<tr bgcolor="#FF7DCF">
<!-- Header row -->
<th align="left">PlayerNumber</th>
<th align="left">PlayersFname</th>
<th align="left">PlayersLname</th>
<th align="left">Team </th>
<th align="left">Age</th>
<th align="left">Home Town </th>
<th align="left">Height</th>
<th align="left">Weight</th>
<th align="left">Bats</th>
<th align="left">Throws</th>
<th align="left">Position</th>
<th align="left">Experience Years</th>
<th align="left">ERA</th>
<th align="left">WHIP</th>
<th align="left">PlayerPhoto</th>
</tr>
<xsl:for-each select="Stats/Player"/>
<tr bgcolor="#85F472">
<!-- color is to see if it shows up during testing SEE Mozilla-->
<td>
<xsl:value-of select="Stats/Player/PlayerNumber"/>
</td>
<td>
<xsl:value-of select="Stats/Player/PlayersFname"/>
</td>
<td>
<xsl:value-of select="Stats/Player/PlayersLname"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Team"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Age"/>
</td>
<td>
<xsl:value-of select="Stats/Player/HomeTown"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Height"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Weight"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Bats"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Throws"/>
</td>
<td>
<xsl:value-of select="Stats/Player/Position"/>
</td>
<td>
<xsl:value-of select="Stats/Player/ExperienceYears"/>
</td>
<td>
<xsl:value-of select="Stats/Player/ERA"/>
</td>
<td>
<xsl:value-of select="Stats/Player/WHIP"/>
</td>
<td>
<xsl:value-of select="Stats/Player/PlayerPhoto"/>
</td>
</tr>
<xsl:for-each select="Stats/Player" />
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

XML statrs here*************

<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href=http://www.webdeveloper.com/forum/archive/index.php/"brxsl.xsl"?>

<Stats>
<Player>
<PlayerNumber>67</PlayerNumber>
<PlayersFname>Jon</PlayersFname>
<PlayersLname>Lester</PlayersLname>
<Team>Boston Red Sox</Team>
<Age> 23</Age>
<HomeTown> Tacoma, WA</HomeTown>
<Height>6-2</Height>
<Weight>190</Weight>
<Bats>L </Bats>
<Throws>L</Throws>
<Position>P</Position>
<ExperienceYears>0</ExperienceYears> <!-- less than one year = 0 -->
<ERA>4.76</ERA>
<WHIP>1.62</WHIP>
<PlayerPhoto>JonLester.jpg</PlayerPhoto>
</Player>
<Player>
<PlayerNumber>2</PlayerNumber>
<PlayersFname>George</PlayersFname>
<PlayersLname>Kottaras</PlayersLname>
<Team>Boston Red Sox</Team>
<Age>23</Age>
<HomeTown>Scar, CAN</HomeTown>
<Height>6-0 </Height>
<Weight>185 </Weight>
<Bats>L </Bats>
<Throws>R</Throws>
<Position>C</Position>
<ExperienceYears>0</ExperienceYears> <!-- less than one year = 0 -->
<ERA>n/a</ERA>
<WHIP>n/a</WHIP>
<PlayerPhoto>GeorgeKottaras.jpg</PlayerPhoto>
</Player>
<Player>
<PlayerNumber>45</PlayerNumber>
<PlayersFname>Doug</PlayersFname>
<PlayersLname>Mirabelli</PlayersLname>
<Team>Boston Red Sox </Team>
<Age>36</Age>
<HomeTown>Kingman, AZ </HomeTown>
<Height>6-1 </Height>
<Weight>220</Weight>
<Bats>R</Bats>
<Throws>R</Throws>
<Position>C</Position>
<ExperienceYears>10</ExperienceYears> <!-- less than one year = 0 -->
<ERA>n/a</ERA>
<WHIP>n/a</WHIP>
<PlayerPhoto>DougMirabelli.jpg</PlayerPhoto>
</Player>
<Player>
<PlayerNumber>48</PlayerNumber>
<PlayersFname>Jason</PlayersFname>
<PlayersLname>Varitek</PlayersLname>
<Team>Boston Red Sox </Team>
<Age>34</Age>
<HomeTown> Rochester, MI</HomeTown>
<Height>6-0</Height>
<Weight>230</Weight>
<Bats>B</Bats>
<Throws>R</Throws>
<Position>C</Position>
<ExperienceYears>9</ExperienceYears> <!-- less than one year = 0 -->
<ERA>n/a</ERA>
<WHIP>n/a</WHIP>
<PlayerPhoto>JasonVaritek.jpg</PlayerPhoto>
</Player>
<Player>
<PlayerNumber>98</PlayerNumber>
<PlayersFname>Robert</PlayersFname>
<PlayersLname>Hammock</PlayersLname>
<Team>AZ Diamondbacks</Team>
<Age>29</Age>
<HomeTown>Moon</HomeTown>
<Height>5-10</Height>
<Weight>185</Weight>
<Bats>R</Bats>
<Throws>R</Throws>
<Position>C</Position>
<ExperienceYears>2</ExperienceYears> <!-- less than one year = 0 -->
<ERA>n/a</ERA>
<WHIP>n/a</WHIP>
<PlayerPhoto>RobertHammock.jpg</PlayerPhoto>
</Player>
</Stats>
 
Back
Top