I am trying to display my XML and XSL on a HTML page that is pulled through AJAX. I have got the XML pulling through to the HTML page but the XSL won't seem to display no matter what I do.
Here is my XML code:
<tv_guide>
<channel>
<channel_id> 1 </channel_id>
<program> <!--beginning of channel1-->
<title>News</title>
<time>HELP</time>
<duration_id>1</duration_id>
<description>ABCD</description>
</program>
</channel>
Here is my XSL code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output method='html'/>
<xsl:template match="/">
<xsl:for-each select="program">
<td>
<xsl:attribute name="id">
<xsl:value-of select="duration_id"/> </xsl:attribute>
<xsl:attribute name="colspan">
<xsl:value-of select="duration"/>
</xsl:attribute>
<xsl:value-of select="name"/> </td>
</xsl:for-each >
</tr>
</xsl:template>
</xsl:stylesheet>
Here is my AJAX code:
function loadXMLDocWed()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState===4 && xmlhttp.status===200)
{
document.getElementById("tabs-3").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","URL",true);
xmlhttp.send();
}
Any suggestions that you think may help will be greatly appreciated as I've been stuck on this for a while now.
No comments:
Post a Comment