Snippet of XSLT to create a link to the parent folder of an item in a search result

I wanted to add a link to the parent folder of an item in FAST search results.

I had found an article that said I could use the “SiteName” property.

Unfortunately, this content wasn’t from a SharePoint site, it was from a File Share.

The “SiteName” only returned \\Server\Sharename for each result, never the folder path

For example \\Server\Share\Folder1\SubFolderA\myfile.txt is where the file is

SiteName retured \\Server\Share

I wanted \\Server\Share\Folder1\SubFolderA\

The following XSLT uses a few chained string commands to return the desired results

<xsl:if test="isdocument = 'True'">
   <br/>
   <a>
      <xsl:attribute name="href">
         <xsl:value-of select="substring(url,1,string-length(url) - string-length(title))"/>
      </xsl:attribute>
      <i>Link to Containing Folder</i>
   </a>
</xsl:if>