• 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 

    努力后就不会后悔

  • 相关阅读:
    Mysql:Group Replication & Replication
    使用winsw包装服务将nginx包装为Windows服务
    Nginx的一些常用配置
    在ASP.NET Core 2.0中使用Facebook进行身份验证
    展现层实现增删改查
    ABP创建应用服务
    ABP领域层定义仓储并实现
    ABP领域层创建实体
    通过模板创建一个ABP项目
    Android UI组件:布局管理器
  • 原文地址:https://www.cnblogs.com/jindahao/p/2438897.html
Copyright © 2020-2023  润新知