Internet Explorer 8:
Google Chrome версии 13:
Javascript:
XSLT:
XML:
В IE 8 ничего не всплывает, но Opera и Firefox просто отлично. Когда я загружаю javascript в Chrome 13.1, отображается первый документ XML, а 2-й и 3-й вообще не отображаются. Я ссылаюсь на три xml-файла в xslt-файле. Javascript от w3shools.
Как я могу получить их для заполнения в IE и Chrome?
Files:
load_xml_javascript.html
delivery_and_activity.xsl
delivery.xml
activity.xml
click_through.xml
load_xml_javascript.html
<html>
<head>
<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("delivery.xml");
xsl=loadXMLDoc("delivery_activity_clickthrough.xsl");
// 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);
}
}
</script>
</head>
<body onLoad="displayResult()">
<div id="example" />
</body>
</html>
delivery_and_activity.xsl
<?xml version="1.0" encoding="utf-8"?>
<!-- DWXMLSource="delivery.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-
system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Delivery Summary</title>
</head>
<body>
<h2 style="margin: 25px 0px -20px 30px; color: #003399;">Delivery Summary</h2>
<table style="margin: 25px; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; text-align:left; font-size:12px;
border-collapse:collapse">
<thead>
<tr>
<th width="165" height="30" scope="col" style="background: #b9c9fe url('left.png') left -1px no-repeat; color: #003399;
padding: 8px;">Type</th>
<th width="209" scope="col" style="background: #b9c9fe; color: #003399; padding: 8px;">% of Attempted to Deliver</th>
<th width="90" scope="col" style="background: #b9c9fe url('right.png') right -1px no-repeat; padding: 8px; color:
#003399;">Total</th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<xsl:for-each select="DELIVERY/SUMMARY">
<tr>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="TITLE"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="ATTEMPTED"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="TOTAL"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
<h2 style="margin: 25px 0px -20px 30px; color: #003399;">Activity Summary</h2>
<table style="margin: 25px; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; text-align:left; font-size:12px;
border-collapse:collapse">
<thead>
<tr>
<th width="165" height="30" scope="col" style="background: #b9c9fe url('left.png') left -1px no-repeat; color: #003399;
padding: 8px;">Type</th>
<th width="209" scope="col" style="background: #b9c9fe; color: #003399; padding: 8px;">% of Successfully Delivered</th>
<th width="90" scope="col" style="background: #b9c9fe url('right.png') right -1px no-repeat; padding: 8px; color:
#003399;">Total</th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<xsl:for-each select="document('activity.xml')/ACTIVITY/SUMMARY">
<tr>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="TITLE"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="ATTEMPTED"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="TOTAL"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
<h2 style="margin: 25px 0px -20px 30px; color: #003399;">Click Through Report</h2>
<table style="margin: 25px; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; text-align:left; font-size:12px;
border-collapse:collapse">
<thead>
<tr>
<th width="165" height="30" scope="col" style="background: #b9c9fe url('left.png') left -1px no-repeat; color: #003399;
padding: 8px;">Type</th>
<th width="209" scope="col" style="background: #b9c9fe; color: #003399; padding: 8px;">% of Successfully Delivered</th>
<th width="90" scope="col" style="background: #b9c9fe url('right.png') right -1px no-repeat; padding: 8px; color:
#003399;">Total</th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<xsl:for-each select="document('click_through.xml')/ACTIVITY/SUMMARY">
<tr>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="URL"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="UNIQUE"/></td>
<td style="background: #e8edff; color: #003399; padding: 8px; border-top: 1px solid #fff;"><xsl:value-of
select="TOTAL"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
delivery.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<DELIVERY>
<SUMMARY>
<TITLE>Attempted to deliver</TITLE>
<ATTEMPTED>100</ATTEMPTED>
<TOTAL>21256</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Hard Bounces</TITLE>
<ATTEMPTED>.68</ATTEMPTED>
<TOTAL>145</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Soft Bounces</TITLE>
<ATTEMPTED>4.48</ATTEMPTED>
<TOTAL>953</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Successfully delivered</TITLE>
<ATTEMPTED>94.8</ATTEMPTED>
<TOTAL>20158</TOTAL>
</SUMMARY>
</DELIVERY>
activity.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<ACTIVITY>
<SUMMARY>
<TITLE>Opened</TITLE>
<ATTEMPTED>22.96</ATTEMPTED>
<TOTAL>4629</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Clicked Through</TITLE>
<ATTEMPTED>4.10</ATTEMPTED>
<TOTAL>829</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Replied</TITLE>
<ATTEMPTED>0.12</ATTEMPTED>
<TOTAL>24</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Unsubscribed</TITLE>
<ATTEMPTED>0.25</ATTEMPTED>
<TOTAL>51</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Forwarded</TITLE>
<ATTEMPTED>0.00</ATTEMPTED>
<TOTAL>0</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>Subscribed</TITLE>
<ATTEMPTED>0.00</ATTEMPTED>
<TOTAL>0.00</TOTAL>
</SUMMARY>
<SUMMARY>
<TITLE>SpamComplaints</TITLE>
<ATTEMPTED>0.3</ATTEMPTED>
<TOTAL>6</TOTAL>
</SUMMARY>
</ACTIVITY>
click_through.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<ACTIVITY>
<SUMMARY>
<URL>navbar weddings</URL>
<UNIQUE>1</UNIQUE>
<TOTAL>1</TOTAL>
</SUMMARY>
<SUMMARY>
<URL>navbar honeymoon</URL>
<UNIQUE>1</UNIQUE>
<TOTAL>1</TOTAL>
</SUMMARY>
<SUMMARY>
<URL>submit rfp</URL>
<UNIQUE>1</UNIQUE>
<TOTAL>1</TOTAL>
</SUMMARY>
</ACTIVITY>