16-13.xsl
来自「《JAVASCRIPT 动态网页编程实例手册》一书中的源代码」· XSL 代码 · 共 51 行
XSL
51 行
<?xml version="1.0" encoding="gb2312" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/PLANETS">
<html>
<head>
<title>
运用XSLT
</title>
</head>
<body>
<h1>
使用XSLT转换XML文档
</h1>
<table border="2">
<tr>
<td>名称</td>
<td>质量</td>
<td>半径</td>
<td>自转周期</td>
</tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="PLANET">
<tr>
<td><xsl:value-of select="NAME"/></td>
<td><xsl:apply-templates select="MASS"/></td>
<td><xsl:apply-templates select="RADIUS"/></td>
<td><xsl:apply-templates select="DAY"/></td>
</tr>
</xsl:template>
<xsl:template match="MASS">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
<xsl:value-of select="@UNITS"/>
</xsl:template>
<xsl:template match="RADIUS">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
<xsl:value-of select="@UNITS"/>
</xsl:template>
<xsl:template match="DAY">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
<xsl:value-of select="@UNITS"/>
</xsl:template>
</xsl:stylesheet>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?