xml、xsl、html...
时间:2010-08-12 来源:xiangxiaofeng12
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head><title>结果</title></head>
<body>
<div align="center"><p>冰激凌</p></div>
<div align="center"><p>
<xsl:value=of select="*/name"/>
</p></div>
<xsl:apply_templates select="icecream_shop"/>
</body>
</html>
</xsl:template>
<xsl:template match="icecream_shop">
<p align="center">
<table border="1">
<tr>
<td>货号</td>
<td>品名</td>
<td>价格</td>
<td>描述页</td>
</tr>
<xsl:for-each select="icecream">
<tr>
<td><xsl:value-of select="货号"/></td>
<td><xsl:value-of select="品名"/></td>
<td><xsl:value-of select="价格"/></td>
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="描述页/@网址"/>
</xsl:attribute>
</a>
</td>
</tr>
</xsl:for-each>
</table>
</p>
</xsl:template>
</xsl:stylesheet>