1

I'm attempting to configure the custom XSL for core results search web-part in 2010. The goal here is:

  • Include File name property as a search target
  • Display Link directly to the file

I've accomplished the first part, but the $url variable is to the display page of the document and not the document itself. I'm having a bit of trouble trying to decipher why I'm returning this and NOT the actual document (which of course in default XML has a link to the document). XSL\XSLT is not one of my strong suites so any input is appreciated :)

Here are the modified portions of the default XML 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"/>
       <xsl:variable name="filename" select="filename"/>
       <xsl:variable name="isdocument" select="isdocument"/>


    <xsl:otherwise>
             <a id="{concat($currentId,'_Title')}">
               <xsl:attribute name="href">
                 <xsl:value-of  select="$url"/> <!-- Would like to have this be document url -->
               </xsl:attribute>
               <xsl:attribute name="title">
                 <xsl:value-of select="filename"/>
               </xsl:attribute>

               <xsl:if test="$isdocument">
                <xsl:value-of select="title" />
               </xsl:if>

               <xsl:if test="not($isdocument)">
         <xsl:choose>
          <xsl:when test="hithighlightedproperties/HHTitle[. != '']">
           <xsl:call-template name="HitHighlighting">
            <xsl:with-param name="hh" 

    select="hithighlightedproperties/HHTitle" /> 
           </xsl:call-template>   
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="title"/>
          </xsl:otherwise> 
         </xsl:choose>
               </xsl:if>

             </a>
           </xsl:otherw

ise>
     </xsl:choose>
  • Have you tried path? – Amal Hashim Nov 21 '14 at 16:11
  • Yup - path returns the site path not path to document. There is no property it seems for filepath. – Jesus Shelby Nov 21 '14 at 17:34
  • This may be a situation of missing the forest for the trees. The documents are PDF's and it appears search is not indexing PDF's at the moment. Once I return and am able to confirm I'll post the results - but it appears that will be the cause. – Jesus Shelby Nov 25 '14 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.