📄 conditional.xsl
字号:
<?xml version = "1.0"?>
<!-- Fig. D.13 : conditional.xsl -->
<!-- xsl:choose, xsl:when and xsl:otherwise -->
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
Appointments
<br/>
<xsl:apply-templates select = "planner/year"/>
</body>
</html>
</xsl:template>
<xsl:template match = "year">
<strong>Year: </strong>
<xsl:value-of select = "@value"/>
<br/>
<xsl:for-each select = "date/note">
<xsl:sort select = "../@day" order = "ascending"
data-type = "number"/>
<strong>
Day:
<xsl:value-of select = "../@day"/>/
<xsl:value-of select = "../@month"/>
</strong>
<xsl:choose>
<xsl:when test =
"@time > '0500' and @time < '1200'">
Morning (<xsl:value-of select = "@time"/>):
</xsl:when>
<xsl:when test =
"@time > '1200' and @time < '1700'">
Afternoon (<xsl:value-of select = "@time"/>):
</xsl:when>
<xsl:when test =
"@time > '1700' and @time < '2000'">
Evening (<xsl:value-of select = "@time"/>):
</xsl:when>
<xsl:when test =
"@time > '2000' and @time < '2400'">
Night (<xsl:value-of select = "@time"/>):
</xsl:when>
<xsl:otherwise>
Entire day:
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select = "."/>
<xsl:if test = ". = ''">
n/a
</xsl:if>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -