XSL/XML网页制作入门,入门到精通[16]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 myali88 的 blog

<th>姓名</th><th>英语</th><th>数学</th><th>化学</th>
<xsl:apply-templates select="grade"/>
</table>
</xsl:template>

<xsl:template match="grade">
<tr>
<td><xsl:apply-templates select="name"/></td>
<td><xsl:apply-templates select="english"/></td>
<td><xsl:apply-templates select="math"/></td>
<td><xsl:apply-templates select="chymest"/></td>
</tr>
</xsl:template>

<xsl:template match="name">
<xsl:value-of/>
</xsl:template>

<xsl:template match="english|math|chymest">
<xsl:choose>
<xsl:when test=".[value()$gt$85]">优秀</xsl:when>
<xsl:when test=".[value()$gt$70]">一般</xsl:when>
<xsl:when test=".[value()$gt$60]">起格</xsl:when>
<xsl:otherwise>不起格</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


肖斌 ® - xiaobin © - {xiaobin.net} ™
上例在浏览器中的样子(ie5.0或更新版本)

  说明:在<xsl:choose>选择中,从第一个<xsl:when>开始,逐个测试,直到满足一个测试条件就将其中的内容输出,不再测试后面的条件;如果不满足任何一个条件,则输出<xsl:otherwise>中的内容。

本文关键:XSL/XML网页制作入门,入门到精通
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top