-- 作者:elfmatian
-- 发布时间:5/13/2008 3:49:00 PM
-- 求教2个XSLT属性连接问题(属性值的确认)
1.xslt <?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding ="gb2312" indent="yes"/> <xsl:param name="add_topic"/> <xsl:template match="/"> <html> <head> <link href="../css/forum.css" type="text/css" rel="stylesheet"></link> <title></title> </head> <body> <a href="../default.aspx" class="h1">返回首页</a> <a href="{$add_topic}" class="h1">我要发言</a> <a href="../user/find.aspx">查询</a> <table align="center"> <tbody> <xsl:for-each select ="topics"> <tr> <td align="center">主题</td> <td align="center">内容</td> <td align="center">发表时间</td> <td align="center" width="150px">回复</td> </tr> <xsl:for-each select ="topic"> <tr> <td> <a> <xsl:attribute name="href"> http://localhost/BBS/test.aspx?id=<xsl:value-of select ="@id"/> </xsl:attribute> <xsl:value-of select="subject"/> </a> </td> <td align="center"> <xsl:value-of select ="content"/> </td> <td align="center"> <xsl:value-of select ="date"/> </td> <td align="center"> <xsl:value-of select ="count(reply)"/> </td> </tr> </xsl:for-each> </xsl:for-each> </tbody> </table> </br> </body> </html> </xsl:template> </xsl:stylesheet> 2.xslt <?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="xslt/topic_list.xslt"/> <xsl:output method="html" version="1.0" encoding ="gb2312" indent="yes"/> <xsl:param name="topic_id"></xsl:param> <xsl:template match="/"> <!-- This is an XSLT template file. Fill in this area with the XSL elements which will transform your XML to XHTML. --> <a href="./user/topic_list.aspx" class="h1"> 快速返回</a> <table align="center"> <tbody> <xsl:if test="topics/topic[@id]=$topic_id"> <xsl:for-each select ="topic" > <tr> <td> 主题:<xsl:value-of select ="subject"/> </td> </tr> <tr > <td> 发布时间:<xsl:value-of select ="date"/> </td> </tr> <xsl:if test="author!=''"> <tr> <td> 发布人:<xsl:value-of select ="author"/> </td> </tr> </xsl:if> <tr> <td> 主题内容:<xsl:value-of select ="content"/> </td> </tr> <xsl:for-each select ="reply"> <tr> <td>回复:</td> </tr> <xsl:if test="reply_author!=''"> <tr > <td> <xsl:value-of select="reply_author"/> </td> </tr> </xsl:if> <tr > <td> <xsl:value-of select ="reply_date"/> </td> </tr> <tr > <td> <xsl:value-of select="reply_content"/> </td> </tr> </xsl:for-each> </xsl:for-each> </xsl:if> <tr> <td> </td> </tr> </tbody> </table> </xsl:template> </xsl:stylesheet> 第一个XSLT定义了个href 现在想在第二个XSLT里面想调用那个href 怎么办啊 调试很久都不行 代码还是别人的 因为是XML新手 求教大大吗 在线等啊 谁能救我 加我QQ276230622 帮忙下 [此贴子已经被作者于2008-5-13 16:44:58编辑过]
|