book.xsl

来自「本书通过100个精彩实例」· XSL 代码 · 共 37 行

XSL
37
字号
<xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

  <xsl:template match="/">
    <html>
    <head>
      <title><xsl:value-of select="books/book/name"/></title>
    </head>
    <style>
        body { font-family: Arial; font-size: 18; color:white; }
        li { list-style: square outside; }
    </style>
    <body bgcolor="black">
        <xsl:apply-templates/>
    </body>
    </html>
  </xsl:template>

  <xsl:template match="name">
    <h1><font color="red"><xsl:value-of select="."/></font></h1>
  </xsl:template>

  <xsl:template match="description">
    <h6><xsl:value-of select="."/></h6>
  </xsl:template>

  <xsl:template match="isbn">
    <font size="1">ISBN: <xsl:value-of select="."/></font><br/>
  </xsl:template>

  <xsl:template match="publisher">
    <font size="1">Publisher: <xsl:value-of select="."/></font><br/>
  </xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

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