Build a url in xsl for a dynamic link in SharePoint results page

If you create a custom results page for your SharePoint, you may want to create a custom url. For example, if you have a specific page that displays information and you want the users to go there via the search.
Or, if you want to link to the dispform for a folder instead of the contents of the folder. You could build a url in xsl with variables!


<xsl:variable name = "customv1" select="managed property 1" />
<xsl:variable name = "customv2" select="managed property 2" />
<a href="https//sharepoint/sites/list/page.aspx?customvalue1={$customv1}&amp;customvalue2={$customv2}"> Click here </a>

What this code does is create variables where you can put your mapped metadata. Those variables can be used in the link you create underneath via the {}.

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.

One thought on “Build a url in xsl for a dynamic link in SharePoint results page”

Leave a Reply

%d bloggers like this: