xml:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="cd.xsl"?>
<catalog>
<CD>
<title>listener to mom</title>
<artist>asfman</artist>
<country>China</country>
<year>2007</year>
</CD>
</catalog>
xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<style>
.tb{
border:1px solid red;
border-collapse:collapse;
}
.tb td,th{
line-height:25px;
border:1px solid red;
}
</style>
</head>
<body>
<table class="tb">
<tr>
<th>title</th>
<th>artist</th>
<th>country</th>
<th>year</th>
</tr>
<xsl:for-each select="catalog/CD">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
<td><xsl:value-of select="country" /></td>
<td><xsl:value-of select="year" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
asp:
<%@ Language="Javascript" %>
<%
var xmlDom=Server.CreateObject("Microsoft.XMLDOM");
xmlDom.async=false;
xmlDom.load(Server.Mappath("cd.xml"));
var xslDom=Server.CreateObject("Microsoft.XMLDOM");
xslDom.async=false;
xslDom.load(Server.MapPath("cd.xsl"));
Response.Write(xmlDom.transformNode(xslDom));
%>
posted on 2007-09-30 16:08
汪杰 阅读(741)
评论(0) 编辑 收藏 引用 所属分类:
xml