zoukankan      html  css  js  c++  java
  • XML读取及网页显示

    例题:学生成绩的XML文档

    <?xml version="1.0" encoding="gb2312"?>

    <students>

           <student id="05001">

                         <name>张三</name>

                         <dept>计算机</dept>

                         <course id="001">

                                <title>C程序设计</title>

                                <score>85</score>

                          <date>2000/12/04</date>

                         </course>

                         <course id="002">

                                <title>编译方法</title>

                                <score>79</score>

                          <date>2000/12/06</date>

                         </course>

                         <course id="003">

                                <title>数据结构</title>

                                <score>93</score>

                          <date>2000/12/10</date>

                         </course>

           </student>

           <student id="05002">

                         <name>李四</name>

                         <dept>数学</dept>

                         <course id="004">

                                <title>计算方法</title>

                                <score>95</score>

                          <date>2000/12/04</date>

                         </course>

                         <course id="005">

                                <title>偏微分方程</title>

                                <score>86</score>

            <date>2000/12/07</date>

                         </course>

                         <course id="006">

                                <title>计算复杂性</title>

                                <score>72</score>

                          <date>2000/12/03</date>

                         </course>

           </student>

           <student id="05003">

                         <name>王五</name>

                         <dept>化学</dept>

                         <course id="007">

                                <title>有机化学</title>

                                <score>80</score>

                          <date>2000/12/09</date>

                         </course>

                         <course id="008">

                                <title>无机化学</title>

                                <score>98</score>

                          <date>2000/12/15</date>

                         </course>

                         <course id="009">

                                <title>分子轨道理论</title>

                                <score>79</score>

                          <date>2000/12/23</date>

                         </course>

                         <course id="010">

                                <title>分子生物学</title>

                                <score>88</score>

                          <date>2000/11/27</date>

                         </course>

           </student>

    </students>

    请利用XMLDOM和XSLT编写如下的网页, 通过选择姓名来动态显示每个学生的成绩单。

    请给出网页的代码和运行效果的截屏。

    要求效果图:

    关于xml,xsl,html几者之间的关系以及调用就不再赘述,直接上源码与效果图。

    Xml部分:

    Xsl部分:

    Html部分:

    Loadxmldoc.js部分(就是默认用法了):

    运行效果截图:

     

  • 相关阅读:
    python通过标准输入读取内容,读取键盘输入的内容?接收用户输入?
    Centos修改时间显示的时区,将UTC修改为CST
    python中注释的写法
    python中,数字类型计算
    python中,获取字符串的长度
    python中的字符串常量,是否支持通过下标的方式赋值
    python,如何获取字符串中的子字符串,部分字符串
    python中是否有单独的字符类型,通过下标的方式表示字符串中的字符
    python中,如何将两个变量值进行拼接
    python中,如有个非常长的字符串,在写的时候如何将其分隔
  • 原文地址:https://www.cnblogs.com/STK0210/p/10265892.html
Copyright © 2011-2022 走看看