Here you loop over the result set and output data
foreach($xml->sho->pitcher as $div){
echo '<tr>';
echo '<td align="center" width="35"><font face="Arial" size="1" color="#000000">' . $div->wins[0] . '</font></td>';
echo '</tr>';
}
If you instead somehow first collected your data in a sortable way
foreach($xml->sho->pitcher as $div){
/* can't use: $pitcher[$div->wins[0]] = $div if there can be more than one pitcher with
* same amount of wins */
$pitchers_by_wins[$div->wins[0]][] = $div;
}
And then sorted it before outputting the desired number of rows
// sort in reverse (descending) order
krsort($pitcher_by_wins);
$count = 0;
foreach($pitcher_by_wins as $pitchers) {
foreach($pitchers as $div) {
++$count;
// your existing output code here
}
if ($count == 10)
break;
}
XSLT is a viable alternative, but it also pretty much is a requirement that you learn to understand XPath. Google for tutorials or start by reading their entries in wikipedia. Not sure what the quality of the wiki subjects are, but going straight to the specifications at w3.org might not be an ideal introduction to the subject. w3schools.com may have something on the topic though.