更改Google Search Appliance中的结果标题

出于各种原因,我真的希望能够在Google Mini的搜索结果中显示文件名作为结果标题,而不是默认值。我几乎可以通过替换来做到这一点
<!-- *** Result Title (including PDF tag and hyperlink) *** -->
...
<span class="l">
    <xsl:choose>
      <xsl:when test="T">
        <xsl:call-template name="reformat_keyword">
          <xsl:with-param name="orig_string" select="T"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise><xsl:value-of select="$stripped_url"/></xsl:otherwise>
    </xsl:choose>
</span>
<span class="l">
    <xsl:value-of select="$stripped_url"/>
</span>
剩下的要求是: 用空格替换%20 修剪网址,只留下结束文件名 从末尾修剪文件扩展名 我怎么能做到这一点?     
已邀请:
我想到了。很多代码和功能已经存在,我只需知道我在寻找什么,然后按摩结果。 返回文档的文件名:
<span class="l">
    <xsl:variable name="document_title">
        <xsl:call-template name="last_substring_after">
            <xsl:with-param name="string" select="substring-after(
                                                  $temp_url,
                                                  '/')"/>
            <xsl:with-param name="separator" select="'/'"/>
            <xsl:with-param name="fallback" select="'UNKNOWN'"/>
        </xsl:call-template>
    </xsl:variable>
用空格替换%20:
    <xsl:call-template name="replace_string">
        <xsl:with-param name="find" select="'%20'"/>
        <xsl:with-param name="replace" select="' '"/>
        <xsl:with-param name="string" select="$document_title"/>
    </xsl:call-template>
</span>
    
此外,可以使用额外的查找/替换变量删除文件扩展名。
<xsl:variable name="document_title_remove_extension">
    <xsl:call-template name="replace_string">
      <xsl:with-param name="find" select="'.pdf'"/>
      <xsl:with-param name="replace" select="''"/>
      <xsl:with-param name="string" select="$document_title"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:call-template name="replace_string">
      <xsl:with-param name="find" select="'%20'"/>
      <xsl:with-param name="replace" select="' '"/>
      <xsl:with-param name="string" select="$document_title_remove_extension"/> 
  </xsl:call-template>
</span>
    

要回复问题请先登录注册