zoukankan      html  css  js  c++  java
  • SharePoint:替换搜索结果连接URL 金大昊(jindahao)

    需求:

    对搜索结果(只是针对BCS数据)的URL连接地址替换为需要的url地址。

    解决办法:

     1.编辑“搜索核心结果webpart”。

     2.编辑xsl文件 

      。。。。
      <!--jindahao add replace funcation -->
        <xsl:template name="string-replace-all">
          <xsl:param name="text" />
          <xsl:param name="replace" />
          <xsl:param name="by" />
          <xsl:choose>
            <xsl:when test="contains($text, $replace)">
              <xsl:value-of select="substring-before($text,$replace)" />
              <xsl:value-of select="$by" />
              <xsl:call-template name="string-replace-all">
                <xsl:with-param name="text"
                select="substring-after($text,$replace)" />
                <xsl:with-param name="replace" select="$replace" />
                <xsl:with-param name="by" select="$by" />
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$text" />
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
    <xsl:template match="Result">
            <xsl:variable name="id" select="id"/>
            <xsl:variable name="currentId" select="concat($IdPrefix,$id)"/>
            <xsl:variable name="url" select="url"/>
            <!--jindahao add myUrl -->
            <xsl:variable name="myUrl">
              <xsl:call-template name="string-replace-all">
                <xsl:with-param name="text" select="url" />
                <xsl:with-param name="replace" select="'http://10.246.5.201:80/ProfilePages/_bdc/http___2k8-r2x64en/riskcontrol1_1.aspx'" />
                <xsl:with-param name="by" select="'http://www.baidu.com'" />
              </xsl:call-template>
            </xsl:variable>

     3.保存webpart 

    努力后就不会后悔

  • 相关阅读:
    《leetcode42接雨水》
    《84. 柱状图中最大的矩形》
    [bzoj1565][NOI2009]植物大战僵尸
    [bzoj1497][NOI2006]最大获利
    [洛谷P4092][HEOI2016/TJOI2016]树
    [洛谷P3760][TJOI2017]异或和
    [洛谷P3758][TJOI2017]可乐
    [洛谷P3761][TJOI2017]城市
    [Uva11134]Fabled Rooks
    又是一年叶落时
  • 原文地址:https://www.cnblogs.com/jindahao/p/2438897.html
Copyright © 2011-2022 走看看