kamagra how much to take

Rewriting Links In Search Results (XSLT)

Occasionly you may find that you want to build your own link translation functions directly into the search XSLT, essentially stating two parameters, the URL attributes to find, and the URL attributes to replace it to, adjusting the return on the SharePoint search results page.

This is not difficult to do, and can simply be done in your XML available in the WebPart properties in your Search Results WebPart. In the below, you can see that the two previously talked about variables are the same URL, however the prefix to is simply being adjusted to the SSL enabled site. Not a very clever example, however accurately solves the problem.

  1. <xsl:variable name="rewrite_from" select="'http://sharepointsecurity.com'" />
  2. <xsl:variable name="rewrite_to" select="'https://sharepointsecurity.com'" />
  3. <xsl:variable name="rewritten_url">
  4. <xsl:choose>
  5. <xsl:when test="starts-with(sitename, $rewrite_from)">
  6. <xsl:value-of select="$rewrite_to" /><xsl:value-of select="substring-after(sitename,$rewrite_from)" />
  7. </xsl:when>
  8. <xsl:otherwise>
  9. <xsl:value-of select="sitename" />
  10. </xsl:otherwise>
  11. </xsl:choose>
  12. </xsl:variable>

Once you have this in your XSLT, you can use the rewritten_url variable to do whatever you want!


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>