我有一个内容查询web部件(cqwp)从新闻链接列表中提取url和标题。cqwp使用在itemstyle.xsl中定义的xslt样式orange.news.links。
我需要对title@title0字段进行排序,如下所述,因为它会导致错误。
有人知道是什么导致了这个错误吗?-非常感谢。xslt代码如下:
<xsl:template name="Orange.News.Links" match="Row[@Style='Orange.News.Links']" mode="itemstyle"> <xsl:param name="CurPos" /> <xsl:param name="Last" /> <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="@URL"/> <xsl:with-param name="UrlColumnName" select="'URL'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="LinkTarget"> <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if> </xsl:variable> <xsl:variable name="SafeImageUrl"> <xsl:call-template name="OuterTemplate.GetSafeStaticUrl"> <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="Header"> <xsl:if test="$CurPos = 1"> <![CDATA[<ul class="list_Links">]]> </xsl:if> </xsl:variable> <xsl:variable name="Footer"> <xsl:if test="$Last = $CurPos"> <![CDATA[</ul>]]> </xsl:if> </xsl:variable> <xsl:value-of select="$Header" disable-output-escaping="yes" /> <li> <a> <xsl:attribute name="href"> <xsl:value-of select="substring-before($DisplayTitle,', ')"></xsl:value-of> </xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="@Description"/> </xsl:attribute> <!-- <xsl:sort select="@Title0"/> --> <xsl:value-of select="@Title0"> </xsl:value-of> </a> </li> <xsl:value-of select="$Footer" disable-output-escaping="yes" /> </xsl:template>
我需要对title@title0字段进行排序 如下所述,因为 导致错误。 有人知道是什么引起的吗 错误?
我需要对title@title0字段进行排序 如下所述,因为 导致错误。
有人知道是什么引起的吗 错误?
对, <xsl:sort/> 只能是 <xsl:apply-templates> 或 <xsl:for-each> (及 <xsl:perform-sort> 在xslt 2.0中)。
<xsl:sort/>
<xsl:apply-templates>
<xsl:for-each>
<xsl:perform-sort>
建议 :至少学习一门xslt和xpath的迷你课程,这样至少可以了解基本概念。