以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  我的XML文件怎么不能浏览  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=7303)


--  作者:kebeixueng
--  发布时间:5/9/2004 9:14:00 AM

--  我的XML文件怎么不能浏览
employee.xml
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="employee.xsl"?>
<personlist>
<employee>
   <name>柯伯勋</name>
   <sex>男</sex>
   <age>25</age>
   <department>开发部</department>
   <headship>网站设计</headship>
</employee>
<employee>
   <name>张云</name>
   <sex>女</sex>
   <age>20</age>
   <department>市场部</department>
   <headship>市场部经理</headship>
</employee>
<employee>
  <name>刘德华</name>
  <sex>男</sex>
  <age>27</age>
  <department>综合部</department>
  <headship>员工</headship>
</employee>
</personlist>
-----------------------------------------------------
employee.xsl
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template>
    <html>
      <head>
      <meta http-equiv="Conten-Type" content="text/html" charset="gb2312"/>
      <title>XML格式演式</title>
      </head>
    <body>
      <xsl:for-each select="temployee">
         <xsl:value-of select="name"/>
            <xsl:value-of select="sex"/>
            <xsl:value-of select="age"/>
           <xsl:value-of select="department"/>
            <xsl:value-of select="headship"/>
           </xsl:for-each>
    </body>
    </html>  
</xsl:template>
</xsl:stylesheet>
   其中我去掉employee.xml文件中的<?xml-stylesheet type="text/xsl" href="employee.xsl"?>就可以查看,我把employee.xsl文件中的"http://www.w3.org/1999/XSL/Transform"改为"http://www.w3.org/TR/WD-xsl"也不能查看,我想请问一下是什么原因?我的IE是5。0,如果是5。5或6.0应该怎么改


--  作者:jwings
--  发布时间:5/9/2004 1:01:00 PM

--  
把你的xsl文件<xsl:template>改成<xsl:template match="/">,<xsl:for-each select="temployee">改成<xsl:for-each select="personlist/employee">,就可以显示,而且如果要按表格显示的话,还要加上table。

--  作者:kebeixueng
--  发布时间:5/9/2004 1:53:00 PM

--  
浏览还是一片空白
--  作者:jwings
--  发布时间:5/9/2004 2:52:00 PM

--  
以下是修改后你的xsl文件。xml原文件不用修改。没有问题。可以运行
<?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>
      <meta http-equiv="Conten-Type" content="text/html" charset="gb2312"/>
      <title>XML格式演式</title>
      </head>
    <body>
      <xsl:for-each select="personlist/employee">
         <xsl:value-of select="name"/>
            <xsl:value-of select="sex"/>
            <xsl:value-of select="age"/>
           <xsl:value-of select="department"/>
            <xsl:value-of select="headship"/>
           </xsl:for-each>
    </body>
    </html>  
</xsl:template>
</xsl:stylesheet>

提一句,你原来文件里面<xsl:for-each select="temployee">打错了。多了个t


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms