在IE6和IE7中执行cout.html的button函数后出错或空白
求高手帮忙调试修改,不胜感激
EX.XML
<?xml version= "1.0 " encoding= "gb2312 "?>
<CATALOG>
<CD>
<TITLE> 天空 </TITLE>
<ARTIST> 王菲 </ARTIST>
<LANGUAGE> 国语 </LANGUAGE>
<COMPANY> 福茂唱片 </COMPANY>
<YEAR> 1995 </YEAR>
<PRICE> 28元 </PRICE>
</CD>
<CD>
<TITLE> 不老的传说 </TITLE>
<ARTIST> 张学友 </ARTIST>
<LANGUAGE> 粤语 </LANGUAGE>
<COMPANY> 宝丽金 </COMPANY>
<YEAR> 1997 </YEAR>
<PRICE> 28元 </PRICE>
</CD>
</CATALOG>
EX.XSL代码如下:
<?xml version= "1.0 " encoding= "gb2312 "?>
<xsl:stylesheet version= "1.0 " xmlns= "http://www.w3.org/1999/XSL/Transform ">
<xsl:template match= "/ ">
<html>
<head>
<title> 转换结果 </title>
</head>
<body>
<p align= "center ">
<font color= "#FF0000 " size= "5 "> CD大卖场 </font>
</p>
<table width= "95% " border= "1 " bgcolor= "#00FFFF ">
<tr>
<td width= "20% ">
<div align= "center "> 专辑名称 </div>
</td>
<td width= "15% ">
<div align= "center "> 歌手 </div>
</td>
<td width= "15% ">
<div align= "center "> 语言 </div>
</td>
<td width= "15% ">
<div align= "center "> 发行公司 </div>
</td>
<td width= "15% ">
<div align= "center "> 年份 </div>
</td>
<td width= "15% ">
<div align= "center "> 价格 </div>
</td>
</tr>
<xsl:for-each select= "//CD ">
<tr>
<td>
<div align= "center ">
<xsl:value-of select= "TITLE "/>
</div>
</td>
<td>
<div align= "center ">
<xsl:value-of select= "ARTIST "/>
</div>
</td>
<td>
<div align= "center ">
<xsl:value-of select= "LANGUAGE "/>
</div>
</td>
<td>
<div align= "center ">
<xsl:value-of select= "COMPANY "/>
</div>
</td>
<td>
<div align= "center ">
<xsl:value-of select= "YEAR "/>
</div>
</td>
<td>
<div align= "center ">
<xsl:value-of select= "PRICE "/>
</div>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
cout.html代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
</head>
<style>
BODY{font:bold 12pt Times New Roman; background-color= "#C0C0C0 "}
</style>
<SCRIPT language= "JavaScript ">
function change()
{
var xmldom = new ActiveXObject( "Microsoft.XMLDOM ");
xmldom.load( "EX.xml ");
var xsldom = new ActiveXObject( "Microsoft.XMLDOM ");
xsldom.load( "EX.xsl ");
document.write(xmldom.transformNode(xsldom));
}
</SCRIPT>
<body>
<input name= "button0 " type= "button " value= "显示转换文件 " onclick= "change() "> </input>
</body>
</html>
[解决办法]
<xsl:stylesheet version= "1.0 " xmlns= "http://www.w3.org/1999/XSL/Transform "> 换成
<xsl:stylesheet version= "1.0 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform ">