-- 作者:mswl
-- 发布时间:4/10/2005 9:07:00 PM
-- 求xml高手帮忙看以下代码错误地方在那里
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="html" indent="yes" version="4.0"/> <!-- Copyright (C) 2004,2005 AspSky.Net. All rights reserved. Written by dvbbs.net Lao Mi Web: http://www.aspsky.net/,http://www.dvbbs.net/ Email: eway@aspsky.net --> <xsl:variable name="tr1"><![CDATA[<tr>]]></xsl:variable> <xsl:variable name="tr2"><![CDATA[</tr>]]></xsl:variable> <xsl:variable name="table"><![CDATA[<table cellspacing="2" cellpadding="2" width="100%" border="0"> <tr> <td width="100%" colspan="3"> </td> </tr> <tr> <td width="25%" valign="middle"> </td> <td width="30%" valign="middle"> </td> <td width="45%" vAlign="middle"> </td> </tr> <tr> <td class="tablebody2" height="20" width=* colspan="3"> </td> </tr> </table>]]></xsl:variable> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" match="/"> <xsl:apply-templates select="BoardList"/> </xsl:template> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" match="BoardList"> <xsl:for-each select="board"> <table cellspacing="0" cellpadding="0" width="98%" align="center" border="0"> <tr> <td width="1" align="left" valign="bottom"><img src=skins/mood/st1.jpg" width=117 height=46 border="0"/></td> <td align="middle" width="99%" background="skins/mood/stbg.jpg"></td> <td width="1" align="right" valign="bottom"><img src="skins/mood/st2.jpg" width=103 height=46 border="0"/></td> </tr> </table> <table cellspacing="1" cellpadding="2" align="center" class="tableBorder1" style="border-bottom-style:none"> <tr> <td width=24 background=skins/mood/st3.jpg><img src=skins/mood/st3.jpg></td> <td> <table cellspacing="1" cellpadding="2" align="center" class="tableBorder1" style="border-bottom-style:none"> <tr> <td align="left" height="20" colspan="6" class="tablebody2"><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text><span id="titlepic_{@boardid}"> <a target="hiddenframe"> <xsl:choose> <xsl:when test="@mode!='0'"><xsl:attribute name="href">cookies.asp?action=setlistmod&thisvalue=0&id=<xsl:value-of select="@boardid"/></xsl:attribute> <img alt="切换到列表模式" src="Skins/Default/plus.gif" border="0"/> </xsl:when> <xsl:otherwise> <xsl:attribute name="href">cookies.asp?action=setlistmod&thisvalue=1&id=<xsl:value-of select="@boardid"/> </xsl:attribute> <img alt="切换到简洁模式" src="Skins/Default/nofollow.gif" border="0"/> </xsl:otherwise> </xsl:choose> </a></span> <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> <xsl:choose> <xsl:when test="/BoardList/@boardid='0'"> <a href="index.asp?boardid={@boardid}" title="进入本分类论坛"><xsl:value-of select="@boardtype" disable-output-escaping="yes" /></a> </xsl:when> <xsl:otherwise><xsl:value-of select="@boardtype" disable-output-escaping="yes" />-论坛列表</xsl:otherwise> </xsl:choose> </td> </tr> </table> <xsl:choose> <xsl:when test="@mode!='1'"><table cellspacing="1" cellpadding="0" align="center" class="tableBorder1"> <tr height="20"> <td valign="middle" align="center" class="tablebody2" ></td> <td valign="middle" align="center" class="tablebody2" ></td> <td valign="middle" align="center" class="tablebody2" >论坛</td> <td valign="middle" align="center" class="tablebody2" >统计</td> <td valign="middle" align="center" class="tablebody2" >最新回复</td> <td valign="middle" align="center" class="tablebody2" >斑竹</td> </tr> <xsl:for-each select="board"> <tr> <td valign="middle" width="46" align="center" class="tablebody1"> <img border="0"><xsl:choose> <xsl:when test="@checkout=1"> <xsl:attribute name="title">认证论坛,<xsl:choose> <xsl:when test="@hasnew=1">有新贴子</xsl:when> <xsl:otherwise>无新贴子</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="$pic_2"/></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="@hasnew=1"><xsl:attribute name="alt">开放的论坛,有新贴子</xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="$pic_1"/></xsl:attribute> </xsl:when> <xsl:otherwise><xsl:attribute name="alt">开放的论坛,无新贴子</xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="$pic_0"/></xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose></img> </td> <td valign="middle" width="46" align="center" class="tablebody1" > <xsl:if test="@indeximg!=''"> <table align="left"> <tr><td> <a href="index.asp?boardid={@boardid}"><img border="0" src="{@indeximg}" alt=""/></a> </td><td width="20"> </td> </tr></table></xsl:if> </td> <td class="tablebody1" width="*" valign="top" onmouseover="this.className='tablebody2'" onmouseout="this.className='tablebody1'"><a href="index.asp?boardid={@boardid}"> <xsl:if test="count(board)!='0'"><xsl:attribute name="alt">有<xsl:value-of select="count(board)"/>个下属论坛</xsl:attribute> </xsl:if> <xsl:value-of select="@boardtype" disable-output-escaping="yes"/></a> <xsl:if test="count(board)!='0'"><a><xsl:attribute name="onmouseover">showmenu(event,BoardJumpList(<xsl:value-of select="@boardid"/>),0);</xsl:attribute>(<xsl:value-of select="count(board)"/>)</a></xsl:if> <table border="0" align="left" cellpadding="0" cellspacing="0"><tr> <td width="*" height="30" valign="bottom"><font face="Arial"><img alt="" src="Skins/Default/Forum_readme.gif" align="middle"/> <xsl:value-of select="@readme" disable-output-escaping="yes"/></font></td> </tr></table> </td> <td valign="middle" class="tablebody2" width="7%"><table width="100%" border="0"> <tr> <td valign="middle" nowrap="nowrap"><img src="Skins/Default/Forum_today.gif" alt="今日发贴数" align="absmiddle"/><font color="red"><xsl:value-of select="@todaynum"/></font></td> </tr> <tr> <td valign="middle" nowrap="nowrap"><img src="Skins/Default/forum_topic.gif" alt="主题贴数" border="0" align="absmiddle"/><xsl:value-of select="@topicnum"/></td> </tr> <tr> <td valign="middle" nowrap="nowrap"><img src="Skins/Default/Forum_post.gif" alt="发贴总数" border="0" align="absmiddle" /><xsl:value-of select="@postnum"/></td> </tr> </table></td> <td width="18%" nowrap="nowrap" class="tablebody1"> <xsl:choose> <xsl:when test="@checkout='1'"> <div></div> <div>认证论坛,请认证用户进入浏览</div> <div></div> </xsl:when> <xsl:otherwise> <div>主题: <a href="Dispbbs.asp?boardid={@lastpost7}&ID={@lastpost6}&replyID={@lastpost1}&skin=1"><xsl:value-of select="@lastpost3"/></a></div> <div>发贴: <a href="dispuser.asp?id={@lastpost5}"><xsl:value-of select="@lastpost0"/></a></div> <div>日期: <xsl:value-of select="@lastpost2"/> <a href="Dispbbs.asp?boardid={@lastpost7}&ID={@lastpost6}&replyID={@lastpost1}&skin=1"><img border="0" src="Skins/Default/lastpost.gif" title="主题:{@lastpost3}"/></a></div> </xsl:otherwise> </xsl:choose> </td><td valign="middle" class="tablebody2" width="16%" align="center" ><xsl:for-each select="boardmasterlist"><xsl:if test="5 > position()"> <a href="Dispuser.asp?name={@urlencode}" title="查看版主 {@master} 的资料" target="_blank"><xsl:value-of select="@master"/></a><xsl:text disable-output-escaping="yes">&nbsp; </xsl:text> </xsl:if> <xsl:if test="last() >4 and position()=last()"><font color="gray">More</font></xsl:if> </xsl:for-each> </td> </tr> </xsl:for-each> </table> </TD> </TR> </TABLE> </td> <td width=23 background=skins/mood/st4.jpg><img src=skins/mood/st4.jpg></td> </tr> </table> <table width='100%' height=28 border=0 align=center cellpadding=0 cellspacing=0> <tr> <td wudth=107><img src=skins/mood/st5.jpg></td> <td width=100% background=skins/mood/st6.jpg> </td> <td wudth=108><img src=skins/mood/st7.jpg></td> </tr> </table> <br/> </xsl:when> <xsl:otherwise><xsl:variable name="simplenesswidth"><xsl:value-of select="floor(1 div (@simplenessCount) * 100) " />%</xsl:variable><table cellspacing="1" cellpadding="0" align="center" class="tableBorder1"> <xsl:for-each select="board"> <xsl:if test="position()-1 mod (../@simplenessCount)='0'"> <xsl:value-of select="$tr1" disable-output-escaping="yes"/> </xsl:if> <td class="tablebody1"> <xsl:attribute name="width"><xsl:value-of select="$simplenesswidth" /></xsl:attribute> <table cellspacing="2" cellPadding="2" width="100%" border="0"> <tr> <td width="100%" colspan="3"> <xsl:attribute name="title"><xsl:value-of select="@readme" /></xsl:attribute> <a> <xsl:attribute name="href">index.asp?boardid=<xsl:value-of select="@boardid"/> </xsl:attribute> <xsl:if test="count(board)!='0'"> <xsl:attribute name="title">有<xsl:value-of select="count(board)"/>个下属论坛</xsl:attribute> </xsl:if> <xsl:value-of select="@boardtype" disable-output-escaping="yes"/></a> <xsl:if test="count(board)!='0'"><a><xsl:attribute name="onmouseover">showmenu(event,BoardJumpList(<xsl:value-of select="@boardid"/>),0);</xsl:attribute>(<xsl:value-of select="count(board)"/>)</a></xsl:if></td> </tr> <tr> <td width="30%" valign="middle" nowrap="nowrap"><img src="Skins/Default/Forum_today.gif" alt="今日发贴数" align="absmiddle"/> <font color="red"><xsl:value-of select="@todaynum"/></font></td> <td width="30%" valign="middle" nowrap="nowrap"><img src="Skins/Default/forum_topic.gif" alt="主题贴数" border="0" align="absmiddle"/> <xsl:value-of select="@topicnum"/></td> <td width="40%" vAlign="middle" nowrap="nowrap"><img src="Skins/Default/Forum_post.gif" alt="发贴总数" border="0" align="absmiddle" /> <xsl:value-of select="@postnum"/></td> </tr> <tr> <td class="tablebody2" height="20" width="*" colspan="3" >版主:<xsl:for-each select="boardmasterlist"><xsl:if test="3 > position()"> <a href="Dispuser.asp?name={@urlencode}" title="查看版主 {@master} 的资料" target="_blank"><xsl:value-of select="@master"/></a> <xsl:text disable-output-escaping="yes">&nbsp; </xsl:text> </xsl:if> <xsl:if test="last() >2 and position()=last()"><font color="gray">More</font></xsl:if> </xsl:for-each> </td> </tr> </table> </td> <xsl:if test="position() mod (../@simplenessCount)=0 or position()=last()"> <xsl:if test="(position() mod (../@simplenessCount))!='0'"> <td class="tablebody1" colspan="{../@simplenessCount}"> <xsl:value-of select="$table" disable-output-escaping="yes"/> </td> </xsl:if> <xsl:value-of select="$tr2" disable-output-escaping="yes"/> </xsl:if> </xsl:for-each> </table> ></td> <td width=23 background=skins/mood/st4.jpg><img src=skins/mood/st4.jpg></td> </tr> </table> <table width='100%' height=28 border=0 align=center cellpadding=0 cellspacing=0> <tr> <td wudth=107><img src=skins/mood/st5.jpg></td> <td width=100% background=skins/mood/st6.jpg> </td> <td wudth=108><img src=skins/mood/st7.jpg></td> </tr> </table> </xsl:otherwise> </xsl:choose> </xsl:for-each> <xsl:if test="/BoardList/@boardid='0'"> <xsl:value-of select="$links" disable-output-escaping="yes"/> </xsl:if> </xsl:template> </xsl:stylesheet>
|