新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → 2个xml和一个xsl 的问题 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 7689 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 2个xml和一个xsl 的问题 举报  打印  推荐  IE收藏夹 
       本主题类别: 样式表技术(XSL, XSLT, XSL-FO, CSS)    
     xhs0923 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:59
      门派:XML.ORG.CN
      注册:2009/7/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xhs0923发送一个短消息 把xhs0923加入好友 查看xhs0923的个人资料 搜索xhs0923在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xhs0923的博客楼主
    发贴心情 2个xml和一个xsl 的问题

    Ixml.xml 如下:
    <?xml version="1.0" encoding="gb2312"?>
    <?xml-stylesheet type="text/xsl" href="Ixml.xsl"?>
    <cours>
    <title>
    <name>电子信息工程专业课表</name>
    </title>
    <title>
    <name>工业电器自动化专业课表</name>
    </title>
    <title>
    <name>计算机软件工程专业课表</name>
    </title>
    <title>
    <name>计算机网络通信专业课表</name>
    </title>
    </cours>

    student.xml

    <?xml version="1.0" encoding="gb2312"?>
    <?xml-stylesheet type="text/xsl" href="xsl1.xsl"?>
    <course>
    <dianzititle>电子信息工程专业课表</dianzititle>
    <gongyetitle>工业电器自动化专业课表</gongyetitle>
    <softtitle>计算机软件工程专业课表</softtitle>
    <nettitle>计算机网络通信专业课表</nettitle>

    <dianzi >
         <first>节数/星期</first>
      <second>星期一</second>
      <third>星期二</third>
      <forth>星期三</forth>
      <fifth>星期四</fifth>
      <sixth>星期五</sixth>
     </dianzi>
     <dianzi >
         <first>1.2</first>
      <second>大学英语</second>
      <third>高等数学</third>
      <forth>信息技术</forth>
      <fifth>实验课</fifth>
      <sixth>dd</sixth>
     </dianzi>
     <dianzi >
      <first>3.4</first>
      <second>高等数学</second>
      <third>大学英语</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </dianzi>
     <dianzi >
      <first>5.6</first>
      <second>线形代数</second>
      <third>5.6</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </dianzi>
     <dianzi >
      <first>7.8</first>
      <second>3.4</second>
      <third>计算机网络</third>
      <forth>7.8</forth>
      <fifth>blank</fifth>
      <sixth>blan</sixth>
     </dianzi>
     <gongye >
         <first>节数/星期</first>
      <second>星期一</second>
      <third>星期二</third>
      <forth>星期三</forth>
      <fifth>星期四</fifth>
      <sixth>星期五</sixth>
     </gongye>
     <gongye >
         <first>1.2</first>
      <second>英语大学</second>
      <third>高等数学</third>
      <forth>信息技术</forth>
      <fifth>实验课</fifth>
      <sixth>dd</sixth>
     </gongye>
     <gongye >
      <first>3.4</first>
      <second>高等数学</second>
      <third>大学英语</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </gongye>
     <gongye >
      <first>5.6</first>
      <second>线形代数</second>
      <third>工业课程</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </gongye>
     <gongye >
      <first>7.8</first>
      <second>3.4</second>
      <third>计算机网络</third>
      <forth>7.8</forth>
      <fifth>blank</fifth>
      <sixth>blan</sixth>
     </gongye>
     <soft >
         <first>节数/星期</first>
      <second>星期一</second>
      <third>星期二</third>
      <forth>星期三</forth>
      <fifth>星期四</fifth>
      <sixth>星期五</sixth>
     </soft>
     <soft >
         <first>1.2</first>
      <second>软件工程</second>
      <third>项目管理</third>
      <forth>blank</forth>
      <fifth></fifth>
      <sixth></sixth>
     </soft>
     <soft >
      <first>3.4</first>
      <second>高等数学</second>
      <third>大学英语</third>
      <forth>java</forth>
      <fifth>数据结构</fifth>
      <sixth>blank</sixth>
     </soft>
     <soft >
      <first>5.6</first>
      <second>线形代数</second>
      <third>离散数学</third>
      <forth></forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </soft>
     <soft >
      <first>7.8</first>
      <second>办公自动化</second>
      <third>计算机网络</third>
      <forth></forth>
      <fifth>blank</fifth>
      <sixth>blan</sixth>
     </soft>
     <net >
         <first>节数/星期</first>
      <second>星期一</second>
      <third>星期二</third>
      <forth>星期三</forth>
      <fifth>星期四</fifth>
      <sixth>星期五</sixth>
     </net>
     <net >
         <first>1.2</first>
      <second>英语大学</second>
      <third>高等数学</third>
      <forth>信息技术</forth>
      <fifth>实验课</fifth>
      <sixth>dd</sixth>
     </net>
     <net >
      <first>3.4</first>
      <second>高等数学</second>
      <third>大学英语</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </net>
     <net >
      <first>5.6</first>
      <second>线形代数</second>
      <third>5.6</third>
      <forth>7.8</forth>
      <fifth>dd</fifth>
      <sixth>dd</sixth>
     </net>
     <net >
      <first>7.8</first>
      <second>3.4</second>
      <third>计算机网络</third>
      <forth>网络安全</forth>
      <fifth>blank</fifth>
      <sixth>blan</sixth>
     </net>
    </course>

    xsl如下:
    <?xml version="1.0" encoding="gb2312"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html>
    <head>
    </head>
    <body bgcolor="#99cc66" align="center">
      <select name="content_sel" style="width: 100%" onchange="
            current_task_path=content_sel.value;
            show_xhtml(content_sel.value + '/Ixml.xml', 'XSL/Ixml.xsl', 'Ixml');
               "></select>
    <table border="1" width="-50%" hight="100%"   >
    <tr><td colspan="6"><center><b><xsl:value-of select="course/dianzititle"></xsl:value-of></b></center></td></tr>
    <xsl:for-each select="course/dianzi">
    <tr >
    <td  bgcolor="blue" ><center><xsl:value-of select="first"/></center></td>
    <td bgcolor="green"><center><xsl:value-of select="second"/></center></td>
    <td bgcolor="yellow"><center><xsl:value-of select="third"/></center></td>
    <td bgcolor="red"><center><xsl:value-of select="forth"/></center></td>
    <td bgcolor="pink" ><center><xsl:value-of select="fifth"/></center></td>
    <td bgcolor="brown"><center><xsl:value-of select="sixth"/></center></td>

    </tr>   
    </xsl:for-each>
    <tr><td  colspan="6"><center><b><xsl:value-of select="course/gongyetitle"></xsl:value-of></b></center></td></tr>
    <xsl:for-each select="course/gongye">
    <tr >
    <td  bgcolor="yellow" ><center><xsl:value-of select="first"/></center></td>
    <td bgcolor="pink"><center><xsl:value-of select="second"/></center></td>
    <td bgcolor="blue"><center><xsl:value-of select="third"/></center></td>
    <td bgcolor="red"><center><xsl:value-of select="forth"/></center></td>
    <td bgcolor="green" ><center><xsl:value-of select="fifth"/></center></td>
    <td bgcolor="brown"><center><xsl:value-of select="sixth"/></center></td>
    </tr>
    </xsl:for-each>
    <tr><td colspan="6"><center><b><xsl:value-of select="course/softtitle"></xsl:value-of></b></center></td></tr>
    <xsl:for-each select="course/soft">
    <tr >
    <td  bgcolor="blue" ><center><xsl:value-of select="first"/></center></td>
    <td bgcolor="green"><center><xsl:value-of select="second"/></center></td>
    <td bgcolor="red"><center><xsl:value-of select="third"/></center></td>
    <td bgcolor="yellow"><center><xsl:value-of select="forth"/></center></td>
    <td bgcolor="brown" ><center><xsl:value-of select="fifth"/></center></td>
    <td bgcolor="pink"><center><xsl:value-of select="sixth"/></center></td>
    </tr>   
    </xsl:for-each>
    <tr><td colspan="6"><center><b><xsl:value-of select="course/nettitle"></xsl:value-of></b></center></td></tr>
      <xsl:for-each select="course/net">
    <tr >
    <td  bgcolor="blue" ><center><xsl:value-of select="first"/></center></td>
    <td bgcolor="yellow"><center><xsl:value-of select="second"/></center></td>
    <td bgcolor="green"><center><xsl:value-of select="third"/></center></td>
    <td bgcolor="red"><center><xsl:value-of select="forth"/></center></td>
    <td bgcolor="pink" ><center><xsl:value-of select="fifth"/></center></td>
    <td bgcolor="brown"><center><xsl:value-of select="sixth"/></center></td>
    </tr>   
    </xsl:for-each>
    </table>
    </body >
      </html>
    </xsl:template>
    </xsl:stylesheet>

    把一个xml导入另外一个xml里,并且使用一个xsl样式!


    [此贴子已经被作者于2009-7-10 18:23:38编辑过]

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/7/9 18:57:00
     
     hexun831012 帅哥哟,离线,有人找我吗?天秤座1983-10-12
      
      
      威望:1
      等级:研二(Pi-Calculus看得一头雾水)(版主)
      文章:800
      积分:5114
      门派:XML.ORG.CN
      注册:2006/12/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给hexun831012发送一个短消息 把hexun831012加入好友 查看hexun831012的个人资料 搜索hexun831012在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看hexun831012的博客2
    发贴心情 
    用document()函数倒入索引
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/7/10 17:11:00
     
     GoogleAdSense天秤座1983-10-12
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/28 7:59:32

    本主题贴数2,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    60.547ms