以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML源码及示例(仅原创和转载) 』  (http://bbs.xml.org.cn/list.asp?boardid=32)
----  请教高手:有一个难题困惑小弟了许久了-_-  (http://bbs.xml.org.cn/dispbbs.asp?boardid=32&rootid=&id=40647)


--  作者:raull
--  发布时间:11/29/2006 2:14:00 PM

--  请教高手:有一个难题困惑小弟了许久了-_-
现有一个项目遇到这样一个问题:
有a.xml如下:
<?xml version="1.0" encoding="gb2312"?>
<?xml:stylesheet type="text/xsl" href="a.xsl"?>
<subject>
<description/>
<classes>
<class>
   <topics>
      <topic>
 <topicid>189976</topicid>
 <topicName>主题0.1.1</topicName>
      </topic>
      <topic>
                <topicid>189976</topicid>
 <topicName>主题0.1.2</topicName>
      </topic>
      <topic>
 <topicid>189976</topicid>
 <topicName>主题0.1.3</topicName>
      </topic>
      <topic>
 <topicid>189976</topicid>
 <topicName>主题0.1.4</topicName>
      </topic>
      <topic>
 <topicid>189976</topicid>
 <topicName>主题0.1.5</topicName>
     </topic>
     <topic>
 <topicid>189976</topicid>
 <topicName>主题0.1.6</topicName>
    </topic>
    </topics>
    <children/>
</class>
<class>
  .....
</class>
</classes>
</subject>

xsl文件如下:
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes">
<xsl:output method="html" encoding="GB2312"/>
<xsl:template match="subject">
<html>
<head>
<title>a.xml</title>
<body>
<center>
........
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">       
<!--每次只显示2条记录(主题)-->
<xsl:for-each select="topics/topic[position() &lt;3]" >
<TR>
  <td>
  <A href="http://sonicbbs.eastday.com/topicdisplay.asp?TopicID={topicid}">
       <xsl:value-of select="topicName"></xsl:value-of>
  </A><BR></BR>
  </td>
</TR>
</xsl:for-each>
<TR>
  <TD align="right">
        <A href="" alt="更多...">More...</A><BR></BR><BR></BR>
  </TD>
</TR>
</TABLE>
........
</center>    
</body>
</html>
</xsl:template>

我该如何在点击"More..."之后能显示全部的5条<topic>标签下的<topicName>数据呢?望高手指点。


--  作者:SATOKO2006
--  发布时间:12/30/2006 3:26:00 PM

--  
很简单,LZ你在<A href="#" alt="更多...">More...</A>加上一个onClick方法,用这个方法去控制这段代码:<xsl:for-each select="topics/topic[position() &lt;3]" >即可。
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms