XSL/XML网页制作入门,入门到精通[3]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 myali88 的 blog

.

<?xml version="1.0" encoding="iso8859-1" ?>
<catalog>
<cd>
<title>empire burlesque</title>
<artist>bob dylan</artist>
<country>usa</country>
<company>columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
.
.


下面是完整的xsl文件(cd_catalog.xsl):

程序代码:
<?xml version=''1.0''?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/tr/wd-xsl">
<xsl:template match="/">
<html>
<body>
<table border="2" bgcolor="yellow">
<tr>
<th>title</th>
<th>artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>



注意,现在xml文件还没有加入xsl样式表,还没有被转换成html文件。 

下面是用javasript来实现最后转换的html代码:

程序代码:
本文关键:XSL/XML网页制作入门,入门到精通
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top