我作了个xsl来显示csdn的帖子,请帮忙看看有什么毛病?谢谢!

nchen123 2003-05-30 02:01:05
本人昨天刚刚学了一点xsl的概念,忽然想作一个xsl文件来显示以前保存的csdn的帖子.但是,一调试就出问题了,我怎么也找不到错误,请大家帮我看看!多谢!

文件名取名为csdn.xsl,内容如下:

<?xml version="1.0" encoding="GB2312" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR-WD-xsl">

<!--根模板-->
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>CSDN论坛精华贴</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates select="Topic" />
</BODY>
</HTML>
</xsl:template>

<!--主题模板-->
<xsl:template match="Topic">
<table border="1">
<tr>
<td>
<xsl:apply-templates select="Issue" />
</td>
</tr>
<tr>
<td>
<xsl:apply-templates select="Replys" />
</td>
</tr>
</table>
</xsl:template>

<!--问题模板-->
<xsl:template match="Issue">
<table border="0">
<tr>
<td>主题:</td>
<td>
<xsl:apply-templates select="Topic/Issue/TopicName" />
</td>
</tr>
<tr>
<td>作者:</td>
<td>
<xsl:apply-templates select="Topic/Issue/PostUserID" />
(<xsl:apply-templates select="Topic/Issue/PostUserNickName" />)
</td>
</tr>
<tr>
<td>等级:</td>
<td>
<xsl:apply-templates select="Topic/Issue/ranknum" />
</td>
</tr>
<tr>
<td>信誉值:</td>
<td>
<xsl:apply-templates select="Topic/Issue/credit" />
</td>
</tr>
<tr>
<td>所属论坛:</td>
<td>
<xsl:apply-templates select="Topic/Issue/RoomName" />
</td>
</tr>
<tr>
<td>问题点数:</td>
<td>
<xsl:apply-templates select="Topic/Issue/Point" />
</td>
</tr>
<tr>
<td>回复次数:</td>
<td>
<xsl:apply-templates select="Topic/Issue/ReplyNum" />
</td>
</tr>
<tr>
<td>发表时间:</td>
<td>
<xsl:apply-templates select="Topic/Issue/PostDateTime" />
</td>
</tr>
</table>
</xsl:template>

<!--主题模板-->
<xsl:template match="Topic/Issue/TopicName">
<xsl:value-of />
</xsl:template>

<!--发贴人ID模板-->
<xsl:template match="Topic/Issue/PostUserID">
<xsl:value-of />
</xsl:template>

<!--发贴人呢称模板-->
<xsl:template match="Topic/Issue/PostUserNickName">
<xsl:value-of />
</xsl:template>

<!--等级模板-->
<xsl:template match="Topic/Issue/ranknum">
<xsl:value-of />
</xsl:template>

<!--信誉值模板-->
<xsl:template match="Topic/Issue/credit">
<xsl:value-of />
</xsl:template>

<!--所属论坛模板-->
<xsl:template match="Topic/Issue/RoomName">
<xsl:value-of />
</xsl:template>

<!--点数模板-->
<xsl:template match="Topic/Issue/Point">
<xsl:value-of />
</xsl:template>

<!--回复数模板-->
<xsl:template match="Topic/Issue/ReplyNum">
<xsl:value-of />
</xsl:template>

<!--发表时间模板-->
<xsl:template match="Topic/Issue/PostDateTime">
<xsl:value-of />
</xsl:template>


<!--所有回复模板-->
<xsl:template match="Topic/Replys">
<table border="0">
<xsl:for-each select="Topic/Replys/Reply">
<xsl:apply-templates select="Topic/Replys/Reply" />
</xsl:for-each>
</table>
</xsl:template>

<!--回复模板-->
<xsl:template match="Topic/Replys/Reply">
<tr bgcolor="#ffff00">
<td>
回复人:
<xsl:apply-templates select="Topic/Replys/Reply/PostUserID" />
(<xsl:apply-templates select="Topic/Replys/Reply/PostUserNickName" />)
(<xsl:apply-templates select="Topic/Replys/Reply/ranknum" />)
信誉:
(<xsl:apply-templates select="Topic/Replys/Reply/credit" />)
<xsl:apply-templates select="Topic/Replys/Reply/PostDateTime" />
得分:
<xsl:apply-templates select="Topic/Replys/Reply/Point" />
</td>
</tr>
<tr>
<td>
<xsl:apply-templates select="Topic/Replys/Reply/Content" />
</td>
</tr>
</xsl:template>

<!--回复人ID模板-->
<xsl:template match="Topic/Replys/Reply/PostUserID" />
<xsl:value-of />
</xsl:template> ---------------------->这里是第167行,错误!

<!--回复人呢称模板-->
<xsl:template match="Topic/Replys/Reply/PostUserNickName" />
<xsl:value-of />
</xsl:template>

<!--回复人等级模板-->
<xsl:template match="Topic/Replys/Reply/ranknum" />
<xsl:value-of />
</xsl:template>

<!--回复人信誉值模板-->
<xsl:template match="Topic/Replys/Reply/credit" />
<xsl:value-of />
</xsl:template>

<!--回复日期时间模板-->
<xsl:template match="Topic/Replys/Reply/PostDateTime" />
<xsl:value-of />
</xsl:template>

<!--回复人得分模板-->
<xsl:template match="Topic/Replys/Reply/Point" />
<xsl:value-of />
</xsl:template>

<!--回复内容模板-->
<xsl:template match="Topic/Replys/Reply/Content" />
<xsl:value-of />
</xsl:template>

</xsl:stylesheet>

双击我要显示的xml文档后,出现了如下错误提示:

无法显示 XML 页。
使用 XSL 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。


--------------------------------------------------------------------------------

结束标记 'xsl:template' 与开始标记 'xsl:stylesheet' 不匹配。处理资源 'file:///G:/参考/xml/code/csdn.xsl' 时出错。第 167 行,位置: 3

</xsl:template>
--^

错误的位置我已经标出来了,请各位高手帮我看看:)
...全文
49 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
nchen123 2003-05-30
  • 打赏
  • 举报
回复
谢谢,这个问题我已经解决了!
梦幻圣者 2003-05-30
  • 打赏
  • 举报
回复
本站的http://expert.csdn.net/expert/Xsl/2.xsl可以正常显示csdn的帖子,好好研究一下就行了。
nchen123 2003-05-30
  • 打赏
  • 举报
回复
多谢两位,我将这个错误改正了.现在可以显示,但是内容不对,我还要再修改修改.
月光易水 2003-05-30
  • 打赏
  • 举报
回复
模板错误

line:165
<xsl:template match="Topic/Replys/Reply/PostUserID" /> --〉此处模板标记不应该结束
==>
<xsl:template match="Topic/Replys/Reply/PostUserID" >

line:170,175,180,185,190 有相似错误



:_)
ssm1226 2003-05-30
  • 打赏
  • 举报
回复
所有的<xsl:template match="Topic/Replys/Reply/Content" />

==><xsl:template match="Topic/Replys/Reply/Content">

8,906

社区成员

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

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