|
| |
精品推荐 |
 |
|
| |
|
|
|
|
跟我学XML和XSL
|
日期:2008年1月6日 作者: 查看:[大字体
中字体 小字体]
|
< /grade >
< /document >
为实现按分数分等级显示,其XSL文档(文件名:grade.xsl)内容如下:
< ?xml version="1.0" encoding="GB2312"? >
< xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" >
< xsl:template match="/" >
< HTML >
< HEAD >< TITLE >成绩单< /TITLE >< /HEAD >
< BODY >< xsl:apply-templates select="document"/ >< /BODY >
< /HTML >
< /xsl:template >
< xsl:template match="document" >
< TABLE border="1" cellspacing="0" >
< 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="englishmathchymest" >
< 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 >
上一篇:用xml+xslt实现表格背景色按行交替设置
下一篇:2005年 Web2.0 带动的11大软件
|
| 跟我学XML和XSL 相关文章: |
|
|
|
| 跟我学XML和XSL 相关软件: |
|
|
|
|