+ -
当前位置:首页 → 问答吧 → 写出该xml文件的DTD文件或Schema文件

写出该xml文件的DTD文件或Schema文件

时间:2011-12-24

来源:互联网

<?xml version="1.0" encoding="UTF-8" ?> 
<成绩单>
  <学生 学号=”2006001”>
  <姓名> 张山 </姓名>
  <高等数学> 95分 </高等数学>
  <大学物理> 88分 </大学物理>
  <大学英语> 90分 </大学英语>
  </学生>
  <学生 学号=”2006020”>
  <姓名> 李四 </姓名>
  <高等数学> 90分 </高等数学>
  <大学物理> 80分 </大学物理>
  <大学英语> 70分 </大学英语>
  </学生>
</成绩单>


写出该xml文件的DTD文件或Schema文件,二者选一即可。(其中学号要求唯一,且必须要有)

作者: Jerikc   发布时间: 2011-12-24

<?xml version=”1.0” encoding=”UTF-8” ?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/TR/WD-xsl”>
  <xsl:template match=”/”>
  <HTML>
  <table border=”1”>
<tr>
<th>姓名</th>
<th>高等数学</th>
<th>大学物理</th>
<th>大学英语</th>
  </tr>
  <xsl:apply-templates select=”成绩单/*”>
  </table>
  </HTML>
  </xsl:template>
  <xsl:template match=”//学生[@学号]”>
  <tr>
  <td><xsl:value-of select=”./姓名”/></td>
  <td><xsl:value-of select=”./高等数学”/></td>
  <td><xsl:value-of select=”./大学物理”/></td>
  <td><xsl:value-of select=”./大学英语”/></td>
  </tr>
  </xsl:template>
</xsl:stylesheet>

作者: Jerikc   发布时间: 2011-12-25