-- 作者:xhs0923
-- 发布时间:7/9/2009 6:57:00 PM
-- 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编辑过]
|