【问题标题】:MOSS Content Query Web part itemstyle.xslMOSS 内容查询 Web 部件 itemstyle.xsl
【发布时间】:2011-02-11 07:49:36
【问题描述】:

我有一个内容查询 Web 部件 (CQWP) 从新闻链接列表中提取 URL 和标题。 CQWP 使用 ItemStyle.xsl 中定义的 XSLT 样式 Orange.News.Links。

我需要按照下面注释的方式对标题@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> 

【问题讨论】:

    标签: sharepoint xslt sharepoint-2007 web-parts


    【解决方案1】:

    我需要对标题@Title0 字段进行排序 如下所述,因为它 导致错误。

    有谁知道这是什么原因 错误?

    是的,&lt;xsl:sort/&gt; 只能是 &lt;xsl:apply-templates&gt;&lt;xsl:for-each&gt;(以及 XSLT 2.0 中的 &lt;xsl:perform-sort&gt;)的子节点。

    建议:至少参加一门 XSLT 和 XPath 的迷你课程,以便您至少了解基本概念。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多