我基本上是在编辑 ItemStyle.xsl 以使其检索我需要的内容并通过 CQWP(内容查询 Web 部件)显示。我需要它只显示评论最多的前 5 个帖子。可以通过@NumComments 检索评论。我对 XSL 不够熟悉,不知道该怎么做,我假设使用 count?有小费吗?
这是该模板的当前 XSL 代码,它只显示所有帖子。
<xsl:template name="MostCommented" match="Row[@Style='MostCommented']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<div>
<a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">
<xsl:value-of select="$DisplayTitle"/>
</a>
</div>
</xsl:template>