疯了:为什么title不显示?

jeskee 2003-10-16 02:55:14
研究半天,怎么越来越不明白了,请高手测试一下为什么下面的程序显示时没有title的值
aaa.xml
<?xml version="1.0" encoding="gb2312" ?>
<?xml-stylesheet type="text/xsl" href="Style.xsl" ?>


<Topic>
<item>
<author xh="2">fdsfds</author>
<title>fsd</title>
<time>03/09/17</time>
</item>
<item>
<author xh="3"> </author>
<title>注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意注意</title>
<time>03/09/17</time>
</item>
<item>
<author xh="4"> </author>
<title>fds</title>
<time>03/09/17</time>
</item>
<item>
<author xh="5">fsda</author>
<title>fdas</title>
<time>03/09/17</time>
</item>
<item>
<author xh="6">fdas</author>
<title>fsda</title>
<time>03/09/17</time>
</item>
<item>
<author xh="7">西宁</author>
<title>西宁城北法院刑附民赔偿理赔到位</title>
<time>03/09/19</time>
</item>
<item>
<author xh="8"> </author>
<title>邗江法院跟踪考察制度见成效制度见成效制度见成效</title>
<time>03/09/19</time>
</item>
<item>
<author xh="9"> </author>
<title>焦作中院法官培训中心挂牌成立</title>
<time>03/09/19</time>
</item>
<item>
<author xh="10"> </author>
<title>你好,这是最新法规的第一条记录</title>
<time>03/09/19</time>
</item>
<item>
<author xh="11"> </author>
<title>你好,这是法院新闻的第一条测试记录</title>
<time>03/09/19</time>
</item>
<item>
<author xh="12"> </author>
<title>最高院院长亲自来我院考查</title>
<time>03/09/19</time>
</item>
<item>
<author xh="13"> </author>
<title>信息摘编维护的第一记录,这是一个测试</title>
<time>03/09/22</time>
</item>
<item>
<author xh="14"> </author>
<title>测试一篇行政公文</title>
<time>03/09/22</time>
</item>
<item>
<author xh="15"> </author>
<title>fds</title>
<time>03/09/24</time>
</item>
<item>
<author xh="16"> </author>
<title>fsdfdsfds</title>
<time>03/09/24</time>
</item>
<item>
<author xh="17"> </author>
<title>fdsfds</title>
<time>03/09/24</time>
</item>
<item>
<author xh="18"> </author>
<title>fdsfsd</title>
<time>03/09/24</time>
</item>
<item>
<author xh="19"> </author>
<title>fdsfffffffffffffffffffff</title>
<time>03/09/24</time>
</item>

</Topic>
===================================================
Style.xsl
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>XML测试程序(排序、检索、分页)</title>
<style>
body{ font: 12px "宋体", "Arial", "Times New Roman"; }
table{ font-size: 12px; border: 0px double; border-color: #99CC99 #99CC99 #CCCCCC #CCCCCC; cellpadding:3;cellspacing:3; bgcolor:#eeeeee; text-decoration: blink}
span{ font-size: 12px; color: red; }
</style>
<SCRIPT LANGUAGE="javascript"><xsl:comment><![CDATA[
]]>//</xsl:comment></SCRIPT>
</head>
<body onload="window_onload()">
<p align="center"><span>文章信息浏览</span></p>
<div id="xmldata">
<xsl:for-each select="Topic/item" >
<xsl:element name="item">
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
<xsl:element name="time">
<xsl:value-of select="time" />
</xsl:element>
</xsl:element>
<br/>
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
===========================
谢谢·真打击学习XML的劲头呀,这些问题
...全文
424 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jeskee 2003-10-16
  • 打赏
  • 举报
回复
对了,问题已经解决了·:)
jeskee 2003-10-16
  • 打赏
  • 举报
回复
多谢各位
to: net_lover(孟子E章) :我把for-each放在div里面是想显示出它的结果看一下的,没有其它意思,可以以文本的形式显示
to:kingdomzhf(旭日东升) ( 那会测试不出来我一生气把javascript中的脚本全删了,贴的时候没去掉window_onload
另外这段程序的目的就是想把JSP程序生成的XML数据做为数据岛的形式放在XSL文件里

最终代码是:
<XML id="xmldata">
<Topic>
<xsl:for-each select="Topic/item" >
<xsl:element name="item">
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
<xsl:element name="time">
<xsl:value-of select="time" />
</xsl:element>
</xsl:element>
</xsl:for-each>
</Topic>
</XML>

再次感谢大家感染了我的学习热情!THS
wolf004 2003-10-16
  • 打赏
  • 举报
回复
应该会显示吧!
这句就会是显示xml的title值
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
kingdomzhf 2003-10-16
  • 打赏
  • 举报
回复
window_onload没有啊




<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>XML测试程序(排序、检索、分页)</title>
<style>
body{ font: 12px "宋体", "Arial", "Times New Roman"; }
table{ font-size: 12px; border: 0px double; border-color: #99CC99 #99CC99 #CCCCCC #CCCCCC; cellpadding:3;cellspacing:3; bgcolor:#eeeeee; text-decoration: blink}
span{ font-size: 12px; color: red; }
</style>
<SCRIPT LANGUAGE="javascript"><xsl:comment><![CDATA[
]]>//</xsl:comment></SCRIPT>
</head>
<body>
<p align="center"><span>文章信息浏览</span></p>
<div id="xmldata">
<xsl:for-each select="Topic/item" >
<xsl:element name="item">
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="author">
<xsl:value-of select="author" />
</xsl:element>
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
<xsl:element name="time">
<xsl:value-of select="time" />
</xsl:element>
</xsl:element>
<br/>
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
halfcard 2003-10-16
  • 打赏
  • 举报
回复
有趣.生成
<div id="xmldata">
<item>
<author>fdsfds</author>
<title>fsd</title>
<time>03/09/17</time>
</item><br>
......
</div>
在IE解释时,标签title的内容不显示.将标签改成别的就可以了.

放在div里,干吗?
孟子E章 2003-10-16
  • 打赏
  • 举报
回复
你把for-each放在div里?
孟子E章 2003-10-16
  • 打赏
  • 举报
回复
不会的,看你生成的源代码什么样子吧
jeskee 2003-10-16
  • 打赏
  • 举报
回复
我把title改名为tt就没事了,难道这个也有二义
唉!

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧