test4-11.xsl

来自「关于XML和网页配合使用的好书」· XSL 代码 · 共 46 行

XSL
46
字号

<?xml version='1.0' encoding="gb2312" ?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/TR/WD-xsl"
    xmlns="http://www.w3.org/TR/REC-html40" >
	<xsl:template match="/">
		<html>
		<head>
			<title>网上书屋</title>
		</head> 
		<body>
        <center>
         <h1>阿当网上书屋</h1>
		<table border="1">
          <xsl:apply-templates select="网上书屋/分类"  order-by="@类别" />
		</table>
		</center>
		</body>
		</html>
	</xsl:template>
    <xsl:template match="分类">
        <tr>
        <td><xsl:value-of select="@类别"/>类书籍</td>
        </tr>
        <tr>
          <td>
            <table border="0" >
            <tr>
            <th>书名</th>
		    <th>作者</th>
		    <th>出版社</th>
            <xsl:apply-templates select="书籍" order-by="书名"/>
            </tr>
            </table>
          </td>
        </tr>
    </xsl:template>
    <xsl:template match="书籍">
        <tr>
           <td><xsl:value-of select="书名" /></td>
           <td><xsl:value-of select="作者"/></td>
           <td><xsl:value-of select="出版社"/></td>
        </tr>
	</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?