Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • J 4 posts 24 karma points
    Apr 22, 2010 @ 18:17
    J
    0

    Help with parent and child nodes

    Hey All,

    Sal helped me out earlier with a way to sort and limit. That solution is part of this code and is working great. I'm just having a hiccup that I cant seem to get over. I use the code below to create a leaders board for my baseball teams league. I have two versions one for pitching and one for hitting. Each has their own XML feed. The one for hitting is working great. My problem is with the pitching version. It seems that something was changed in the parent and child nodes of the XML and for the life of me I am missing it and the page is not parsing correctly. Can someone give me a fresh pair of eyes cause I'm wracking my brain and can't get it right or find the issue I am having.

     

    XML Link+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    http://www.pointstreak.com/ws/baseball/?client=nycmbla-a&action=team_pitchingleaders&seasonid=160&teamid=3596

     

    XSLT code++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

     <xsl:output method="html" encoding="iso-8859-1" indent="no"/>
    <xsl:template match="stats">

    <style type="text/css">
    table.ex1 {border-spacing: 0}
    table.ex1 td, th {padding: 0 0.2em}
    table.ex1 tr:nth-child(odd) {color: #000; background: #ECF6FC}
    table.ex1 tr:nth-child(even) {color: #000; background:#FFFFFF }
    </style> 

    <table border="1" width="200" style="border-collapse: collapse" bordercolor="#808080" >

    <tr bgcolor="#808080">
            <th align="center"><b><font face="Arial" size="4" color="#FFFFFF">ERA</font></b></th>
          </tr>

    </table>
    <table border="1" width="200" style="border-collapse: collapse" bordercolor="#808080" >
                <xsl:for-each select="era/player">
                <xsl:sort select="era" lang="language-code" data-type="number" order="ascending" case-order="upper-first|lower-first"/>
                <xsl:if test="position() &lt; 2">

    <tr bgcolor="#FFFFFF">
            <th width="75" align="center" height="70" style="border-right-style: none; border-right-width: medium"><b><font face="Arial" size="1">ERA</font><br></br><font face="Arial" size="5" color="#FF0000"><xsl:value-of select="era"/></font></b></th>
            <th width="125" align="center" height="70" style="border-left-style: none; border-left-width: medium"><b><font face="Arial" size="2">#<xsl:value-of select="jersey"/><br></br><xsl:value-of select="playername"/><br></br></font><font face="Arial" size="2" color="#808080"><xsl:value-of select="teamname"/></font></b></th>
          </tr>
          </xsl:if>
          </xsl:for-each>
    </table>

        <table class="ex1" border="1" width="200" style="border-collapse: collapse" bordercolor="#808080" >
          <tr bgcolor="#808080">
            <th bgcolor="#808080"><b><font face="Arial" size="1" color="#FFFFFF">#</font></b></th>
            <th bgcolor="#808080"><b><font face="Arial" size="1" color="#FFFFFF">PITCHER</font></b></th>
            <th bgcolor="#808080"><b><font face="Arial" size="1" color="#FFFFFF">TEAM</font></b></th>
            <th bgcolor="#808080"><b><font face="Arial" size="1" color="#FFFFFF">ERA</font></b></th>
          </tr>
        
    <xsl:for-each select="era/player">
    <xsl:sort select="era" lang="language-code" data-type="number" order="ascending" case-order="upper-first|lower-first"/>
    <xsl:if test="position() &lt; 6">
    <tr>
    <td align="center" width="30"><font face="Arial" size="1" color="#000000"><xsl:value-of select="jersey"/></font></td>
    <td align="center" width="100"><font face="Arial" size="1" color="#000000"><xsl:value-of select="playername"/></font></td>
    <td align="center" width="35"><font face="Arial" size="1" color="#000000"><xsl:value-of select="teamname"/></font></td>
    <td align="center" width="35"><font face="Arial" size="1" color="#000000"><xsl:value-of select="era"/></font></td>
    </tr>
    </xsl:if>
    </xsl:for-each>
    </table></xsl:template>
     
    </xsl:stylesheet>

     

    XML Feed++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    <stats>
    <link>team_stats.html?teamid=3596%26;seasonid=160</link>

    <sho>

    <player>
    <link>player.html?playerid=36631%26;seasonid=160</link>
    <jersey>54</jersey>
    <playername>Rodriguez, Milton</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>0</runs>
    <er>0</er>
    <hits/>
    <bb>0</bb>
    <so>3</so>
    <bf>18</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.222</oobp>
    <oslg>.222</oslg>
    <oavg>.222</oavg>
    <era>0.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=45322%26;seasonid=160</link>
    <jersey>38</jersey>
    <playername>Nordsten, Matt</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>7</runs>
    <er>6</er>
    <hits/>
    <bb>4</bb>
    <so>0</so>
    <bf>18</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.556</oobp>
    <oslg>.615</oslg>
    <oavg>.385</oavg>
    <era>27.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=44876%26;seasonid=160</link>
    <jersey>21</jersey>
    <playername>Kolinoski, Travis</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>4</runs>
    <er>4</er>
    <hits/>
    <bb>3</bb>
    <so>2</so>
    <bf>13</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.538</oobp>
    <oslg>.800</oslg>
    <oavg>.400</oavg>
    <era>18.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=36536%26;seasonid=160</link>
    <jersey>25</jersey>
    <playername>Aquino, Jose</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>3</runs>
    <er>3</er>
    <hits/>
    <bb>3</bb>
    <so>5</so>
    <bf>25</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.360</oobp>
    <oslg>.200</oslg>
    <oavg>.211</oavg>
    <era>5.40</era>
    </player>
    </sho>

    <era>

    <player>
    <link>player.html?playerid=36631%26;seasonid=160</link>
    <jersey>54</jersey>
    <playername>Rodriguez, Milton</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>0</runs>
    <er>0</er>
    <hits/>
    <bb>0</bb>
    <so>3</so>
    <bf>18</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.222</oobp>
    <oslg>.222</oslg>
    <oavg>.222</oavg>
    <era>0.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=36536%26;seasonid=160</link>
    <jersey>25</jersey>
    <playername>Aquino, Jose</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>3</runs>
    <er>3</er>
    <hits/>
    <bb>3</bb>
    <so>5</so>
    <bf>25</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.360</oobp>
    <oslg>.200</oslg>
    <oavg>.211</oavg>
    <era>5.40</era>
    </player>
    +
    <player>
    <link>player.html?playerid=44876%26;seasonid=160</link>
    <jersey>21</jersey>
    <playername>Kolinoski, Travis</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>4</runs>
    <er>4</er>
    <hits/>
    <bb>3</bb>
    <so>2</so>
    <bf>13</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.538</oobp>
    <oslg>.800</oslg>
    <oavg>.400</oavg>
    <era>18.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=45322%26;seasonid=160</link>
    <jersey>38</jersey>
    <playername>Nordsten, Matt</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>7</runs>
    <er>6</er>
    <hits/>
    <bb>4</bb>
    <so>0</so>
    <bf>18</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.556</oobp>
    <oslg>.615</oslg>
    <oavg>.385</oavg>
    <era>27.00</era>
    </player>
    </era>
    +
    <wins>

    <player>
    <link>player.html?playerid=36631%26;seasonid=160</link>
    <jersey>54</jersey>
    <playername>Rodriguez, Milton</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>0</runs>
    <er>0</er>
    <hits/>
    <bb>0</bb>
    <so>3</so>
    <bf>18</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.222</oobp>
    <oslg>.222</oslg>
    <oavg>.222</oavg>
    <era>0.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=45322%26;seasonid=160</link>
    <jersey>38</jersey>
    <playername>Nordsten, Matt</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>7</runs>
    <er>6</er>
    <hits/>
    <bb>4</bb>
    <so>0</so>
    <bf>18</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.556</oobp>
    <oslg>.615</oslg>
    <oavg>.385</oavg>
    <era>27.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=44876%26;seasonid=160</link>
    <jersey>21</jersey>
    <playername>Kolinoski, Travis</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>4</runs>
    <er>4</er>
    <hits/>
    <bb>3</bb>
    <so>2</so>
    <bf>13</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.538</oobp>
    <oslg>.800</oslg>
    <oavg>.400</oavg>
    <era>18.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=36536%26;seasonid=160</link>
    <jersey>25</jersey>
    <playername>Aquino, Jose</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>3</runs>
    <er>3</er>
    <hits/>
    <bb>3</bb>
    <so>5</so>
    <bf>25</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.360</oobp>
    <oslg>.200</oslg>
    <oavg>.211</oavg>
    <era>5.40</era>
    </player>
    </wins>
    +
    <saves>
    +
    <player>
    <link>player.html?playerid=36631%26;seasonid=160</link>
    <jersey>54</jersey>
    <playername>Rodriguez, Milton</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>0</runs>
    <er>0</er>
    <hits/>
    <bb>0</bb>
    <so>3</so>
    <bf>18</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.222</oobp>
    <oslg>.222</oslg>
    <oavg>.222</oavg>
    <era>0.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=45322%26;seasonid=160</link>
    <jersey>38</jersey>
    <playername>Nordsten, Matt</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>7</runs>
    <er>6</er>
    <hits/>
    <bb>4</bb>
    <so>0</so>
    <bf>18</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.556</oobp>
    <oslg>.615</oslg>
    <oavg>.385</oavg>
    <era>27.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=44876%26;seasonid=160</link>
    <jersey>21</jersey>
    <playername>Kolinoski, Travis</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>0</losses>
    <ip>2.0</ip>
    <runs>4</runs>
    <er>4</er>
    <hits/>
    <bb>3</bb>
    <so>2</so>
    <bf>13</bf>
    <games>1</games>
    <gs>0</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.538</oobp>
    <oslg>.800</oslg>
    <oavg>.400</oavg>
    <era>18.00</era>
    </player>
    +
    <player>
    <link>player.html?playerid=36536%26;seasonid=160</link>
    <jersey>25</jersey>
    <playername>Aquino, Jose</playername>
    <teamname>Rip Tide</teamname>
    <wins>0</wins>
    <losses>1</losses>
    <ip>5.0</ip>
    <runs>3</runs>
    <er>3</er>
    <hits/>
    <bb>3</bb>
    <so>5</so>
    <bf>25</bf>
    <games>1</games>
    <gs>1</gs>
    <cg>0</cg>
    <cgl>0</cgl>
    <sho>0</sho>
    <sv>0</sv>
    <bsv>0</bsv>
    <oobp>.360</oobp>
    <oslg>.200</oslg>
    <oavg>.211</oavg>
    <era>5.40</era>
    </player>
    </saves>
    </stats>

     

     

     

  • J 4 posts 24 karma points
    Apr 23, 2010 @ 01:45
    J
    0

    figured it out. Was a carriage return that was put in by a text edior

Please Sign in or register to post replies

Write your reply to:

Draft