Ok I have the following XML file:

<?xml version='1.0'?>
<root>
  <GAME_INFO>
    <TIME>xcxvxc</TIME>
    <CLOCKON>False</CLOCKON>
    <PHASE>1</PHASE>
    <GAMEID>43534534534535</GAMEID>
    <COMP>SUPER</COMP>
  </GAME_INFO>
  <TEAM type="H" name="Bulls">
    <SCORE>34</SCORE>
    <ABBR>BUL</ABBR>
    <BGCOLOUR>#003366</BGCOLOUR>
    <TXCOLOUR>#CCCCCC</TXCOLOUR>
  </TEAM>
  <TEAM type="A" name="Chiefs">
    <SCORE>10</SCORE>
    <ABBR>CHF</ABBR>
    <BGCOLOUR>#CCCCCC</BGCOLOUR>
    <TXCOLOUR>#CC9933</TXCOLOUR>
  </TEAM>
  <KICKERS team="H">
    <KICKER_NAME>10.  STEYN</KICKER_NAME>
    <KICKER_STAT>PEN-1/1 CON-3/3 DG-1/1</KICKER_STAT>
  </KICKERS>
  <SCORERS team="H">
    <NAME0>9.  du PREEZ</NAME0>
    <SCORE0>2</SCORE0>
    <NAME1>11.  HABANA</NAME1>
    <SCORE1>1</SCORE1>
    <NAME2>1.  STEENKAMP</NAME2>
    <SCORE2>1</SCORE2>
  </SCORERS>
  <KICKERS team="A">
    <KICKER_NAME>10.  DONALD</KICKER_NAME>
    <KICKER_STAT>PEN-1/1 CON-1/1 DG-0/0</KICKER_STAT>
  </KICKERS>
  <SCORERS team="A">
    <NAME0>14.  MASAGA</NAME0>
    <SCORE0>1</SCORE0>
    <NAME1>-</NAME1>
    <SCORE1>0</SCORE1>
    <NAME2>-</NAME2>
    <SCORE2>0</SCORE2>
  </SCORERS>
  <JUMPERS team="H">
    <NAME0 name="4.  BOTHA"/>
    <TOTAL0>1</TOTAL0>
    <AGAINST0>1</AGAINST0>
    <NAME1 name="5.  MATFIELD"/>
    <TOTAL1>0</TOTAL1>
    <AGAINST1>0</AGAINST1>
    <NAME2 name="7.  POTGIETER"/>
    <TOTAL2>1</TOTAL2>
    <AGAINST2>1</AGAINST2>
  </JUMPERS>
  <JUMPERS team="A">
    <NAME0 name="4.  CLARKE"/>
    <TOTAL0>1</TOTAL0>
    <AGAINST0>0</AGAINST0>
    <NAME1 name="5.  O'NEILL"/>
    <TOTAL1>0</TOTAL1>
    <AGAINST1>0</AGAINST1>
    <NAME2 name="23.  MESSAM"/>
    <TOTAL2>1</TOTAL2>
    <AGAINST2>0</AGAINST2>
  </JUMPERS>
  <STAT name="POSSESSION">
    <TEAM1>36</TEAM1>
    <TEAM2>64</TEAM2>
  </STAT>
  <STAT name="TACKLES_MISSED">
    <TEAM1>5</TEAM1>
    <TEAM2>5</TEAM2>
  </STAT>
  <STAT name="TURNOVERS_WON">
    <TEAM1>4</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="BREAKDOWN_TURNOVERS_WON">
    <TEAM1>1</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="ERRORS_MADE">
    <TEAM1>3</TEAM1>
    <TEAM2>4</TEAM2>
  </STAT>
  <STAT name="TURNOVERS_CONCEDED">
    <TEAM1>3</TEAM1>
    <TEAM2>12</TEAM2>
  </STAT>
  <STAT name="LINE_BREAKS">
    <TEAM1>1</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="SCRUMS_WON">
    <TEAM1>1</TEAM1>
    <TEAM2>4</TEAM2>
  </STAT>
  <STAT name="PENALTIES_CONCEDED">
    <TEAM1>2</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="AGAINST_THROW">
    <TEAM1>3</TEAM1>
    <TEAM2>0</TEAM2>
  </STAT>
  <STAT name="TRIES">
    <TEAM1>4</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="LINEOUTS_WON">
    <TEAM1>5</TEAM1>
    <TEAM2>4</TEAM2>
  </STAT>
  <STAT name="INTERCEPTS">
    <TEAM1>2</TEAM1>
    <TEAM2>0</TEAM2>
  </STAT>
  <STAT name="MINS_IN_POSSESSION">
    <TEAM1>16</TEAM1>
    <TEAM2>21</TEAM2>
  </STAT>
  <STAT name="PASSES_COMPLETED">
    <TEAM1>44</TEAM1>
    <TEAM2>59</TEAM2>
  </STAT>
  <STAT name="FREE_KICKS">
    <TEAM1>5</TEAM1>
    <TEAM2>5</TEAM2>
  </STAT>
  <STAT name="MINS_IN_OPP_22">
    <TEAM1>5</TEAM1>
    <TEAM2>1</TEAM2>
  </STAT>
  <STAT name="TACKLES_MADE">
    <TEAM1>41</TEAM1>
    <TEAM2>39</TEAM2>
  </STAT>
  <STAT name="HANDLING_ERRORS">
    <TEAM1>3</TEAM1>
    <TEAM2>4</TEAM2>
  </STAT>
  <STAT name="TERRITORY">
    <TEAM1>54</TEAM1>
    <TEAM2>46</TEAM2>
  </STAT>
  <STAT name="PICK_AND_GO">
    <TEAM1>3</TEAM1>
    <TEAM2>3</TEAM2>
  </STAT>
  <STAT name="NOT_STRAIGHT">
    <TEAM1>0</TEAM1>
    <TEAM2>0</TEAM2>
  </STAT>
  <STAT name="BREAKDOWNS">
    <TEAM1>34</TEAM1>
    <TEAM2>33</TEAM2>
  </STAT>
  <STAT name="SHORT-ARM_PENALTIES_CONCEDED">
    <TEAM1>5</TEAM1>
    <TEAM2>5</TEAM2>
  </STAT>
</root>

and the following XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="child::root">
 <html>
  <head>
   <title>
	KIDS sportinfo test
   </title>
  </head>
  <body>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
  	<td bgcolor="{TEAM[@type='H']/BGCOLOUR}" width="5%"></td>
	<td width="40%" bgcolor="#333333"><xsl:value-of select="TEAM[@type='H']/@name" /></td>
	<td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="TEAM[@type='H']/SCORE" /></td>
	<td colspan="2" style="background-color:#000;"></td>
	<td width="4%" bgcolor="{TEAM[@type='H']/BGCOLOUR}" align="center"><xsl:value-of select="TEAM[@type='H']/ABBR" /></td>
	<td width="4%" bgcolor="{TEAM[@type='A']/BGCOLOUR}" align="center"><xsl:value-of select="TEAM[@type='A']/ABBR" /></td>
  </tr>
  <tr>
    <td bgcolor="{TEAM[@type='A']/BGCOLOUR}" width="5%"></td>
    <td width="40%" bgcolor="#333333"><xsl:value-of select="TEAM[@type='A']/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="TEAM[@type='A']/SCORE" /></td>
    <td bgcolor="#000"></td>
    <td bgcolor="#333333"><span>Territory</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TERRITORY']/TEAM1" /></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TERRITORY']/TEAM2" /></td>
  </tr>
  <tr>
  <xsl:choose>
  <xsl:when test="descendant::CLOCKON='True'">
    <td colspan="2" bgcolor="#336600" id="TIME1">TIME</td>
    <td width="6%" bgcolor="#336600" align="center"><xsl:value-of select="descendant::TIME" /></td>
  </xsl:when>
  <xsl:otherwise>
  	<td colspan="2" bgcolor="#990000" id="TIME1">TIME</td>
    <td width="6%" bgcolor="#990000" align="center"><xsl:value-of select="descendant::TIME" /></td>
  </xsl:otherwise>
  </xsl:choose> 
    <td bgcolor="#000"></td>
    <td width="41%" bgcolor="#333333"><span>Possession</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='POSSESSION']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='POSSESSION']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" style="background-color:#003366;"><span>CURRENT PHASE</span></td>
    <td width="6%" style="background-color:#003366;" align="center"><xsl:value-of select="descendant::PHASE"/></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Mins in Possession</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='MINS_IN_POSSESSION']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='MINS_IN_POSSESSION']/TEAM2" /></td>
  </tr>
  <tr>
    <td height="28" colspan="3" bgcolor="#333333" align="center"><span>Lineouts</span></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Mins in Opp 22</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='MINS_IN_OPP_22']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='MINS_IN_OPP_22']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="{TEAM[@type='H']/BGCOLOUR}"><xsl:value-of select="TEAM[@type='H']/ABBR" /></td>
    <td width="6%" bgcolor="#990000" align="center"><xsl:value-of select="STAT[@name='LINEOUTS_WON']/TEAM1" /></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Penalties Conceded</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='PENALTIES_CONCEDED']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='PENALTIES_CONCEDED']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='H']/NAME0/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='H']/TOTAL0" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='H']/AGAINST0" /></font></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Turnovers Conceded</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TURNOVERS_CONCEDED']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TURNOVERS_CONCEDED']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='H']/NAME1/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='H']/TOTAL1" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='H']/AGAINST1" /></font></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Breakdowns</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='BREAKDOWNS']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='BREAKDOWNS']/TEAM2" /></td>
  </tr>
  <tr>
 	<td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='H']/NAME2/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='H']/TOTAL2" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='H']/AGAINST2" /></font></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>BD Turnovers Won</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='BREAKDOWN_TURNOVERS_WON']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='BREAKDOWN_TURNOVERS_WON']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><span>Against Throw</span></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='AGAINST_THROW']/TEAM1" /></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Handling Errors</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='HANDLING_ERRORS']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='HANDLING_ERRORS']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><span>Not Straight</span></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='NOT_STRAIGHT']/TEAM1" /></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Missed Tackles</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TACKLES_MISSED']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='TACKLES_MISSED']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="{TEAM[@type='A']/BGCOLOUR}"><xsl:value-of select="TEAM[@type='A']/ABBR" /></td>
    <td width="6%" bgcolor="#990000" align="center"><xsl:value-of select="STAT[@name='LINEOUTS_WON']/TEAM2" /></td>
    <td style="background-color:#000;"></td>
    <td bgcolor="#333333"><span>Line breaks</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='LINE_BREAKS']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='LINE_BREAKS']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='A']/NAME0/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='A']/TOTAL0" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='A']/AGAINST0" /></font></td>
    <td style="background-color:#000;"></td>
   	<td bgcolor="#333333"><span>Intercepts</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='INTERCEPTS']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='INTERCEPTS']/TEAM2" /></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='A']/NAME1/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='A']/TOTAL1" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='A']/AGAINST1" /></font></td>
    <td style="background-color:#000;"></td>
   	<td bgcolor="#333333"><span>Scrums Won</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='SCRUMS_WON']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='SCRUMS_WON']/TEAM2" /></td>        
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333"><xsl:value-of select="JUMPERS[@team='A']/NAME2/@name" /></td>
    <td width="6%" bgcolor="#333333" align="center"><xsl:value-of select="JUMPERS[@team='A']/TOTAL2" /><font color="#FFFF00"> - <xsl:value-of select="JUMPERS[@team='A']/AGAINST2" /></font></td>
    <td style="background-color:#000;"></td>
   	<td bgcolor="#333333"><span>Pick and Go</span></td>
    <td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='PICK_AND_GO']/TEAM1" /></td>
	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='PICK_AND_GO']/TEAM2" /></td> 
  </tr>
  <tr>
    	<td colspan="2" bgcolor="#333333"><span>Against Throw</span></td>
    	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='AGAINST_THROW']/TEAM2" /></td>
	    <td style="background-color:#000;"></td>
    	<td colspan="3" rowspan="2"></td>
  	</tr>
  	<tr>
	    <td colspan="2" bgcolor="#333333"><span>Not Straight</span></td>
    	<td bgcolor="#333333" align="center"><xsl:value-of select="STAT[@name='NOT_STRAIGHT']/TEAM2" /></td>
    	<td style="background-color:#000;"></td>
  	</tr>

  </table>
  </body>
 </html>
</xsl:template>
</xsl:stylesheet>

What I need to do is display the data on the web and refresh the data every 5 seconds. I am not aloud to use things like jquery as this site will be used via analogue modem sometimes. So my question is how do I do it?

Also I can not assign the xsl inside the xml and the same source will be viewed elsewhere

Recommended Answers

All 2 Replies

You could use a html meta refresh (not pretty).

<meta http-equiv="refresh" content="5" />

You could use a html meta refresh (not pretty).

<meta http-equiv="refresh" content="5" />

I cant use this as it causes the page to flash when it refreshes.

this is what I have so far but it seems to have chaching issues:

<script>
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}

function displayResult()
{
xml=loadXMLDoc("KIDS-stats.xml");
xsl=loadXMLDoc("beatle.xsl");
document.getElementById("example").innerHTML = "";
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("example").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("example").appendChild(resultDocument);
  }
}setTimeout('displayResult()',3000);
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.