Datasheet

var fragment = xsltProcessor.transformToFragment(xmlDoc, document);
document.getElementById(“menuhere”).innerHTML = “”;
document.getElementById(“menuhere”).appendChild(fragment);
}
if (spanb != null)
{
spanb.innerHTML = transform;
}
//Clear the object and call the getDocument function in 10 seconds
xHRObject.abort();
setTimeout(“getDocument()”, 10000);
}
}
function getDocument()
{
//Reset the function
xHRObject.onreadystatechange = getData;
//IE will cache the GET request; the only way around this is to append a
//different querystring. We add a new date and append it as a querystring
xHRObject.open(“GET”, “SuiteList.xml?id=” + Number(new Date), true);
xHRObject.send(null);
}
4. You will also need an XSL style sheet for this example. This handles the presentation of the data
contained in the XML document. This will be the section that controls which items from the XML
document are displayed and which items are not. Save the XSL style sheet as
MenuDisplay
.xsl
to the Chapter1 folder.
<?xml version=”1.0” encoding=”utf-8”?>
<xsl:stylesheet version=”1.0”
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>
<xsl:output method=”html”/>
<xsl:template match=”/”>
<div onmouseout=” var submenu =
document.getElementById(‘romesubmenu’);submenu.style.visibility = ‘hidden’;return
true;” >
<table>
<tr>
<td id=”td1” class=”menublock”
onMouseOver=”td1.style.backgroundColor=’#cccccc’;”
onMouseOut=”td1.style.backgroundColor=’#eeeeff’;” >
Hotel Paris
</td>
</tr>
<tr>
23
Chapter 1: Introducing Ajax
04_106754 ch01.qxp 2/9/07 6:15 PM Page 23