Reputation: 3503
This is my very first attempt at dealing with XSL, so please be kind :)
I am modifying the SharePoint 2010 peoplesearch results page - specifically the "View in Organizational Browser" line. I have added the orgbrowser webpart to our main site and don't want to direct users to the mysite for this link.
Here is the modified code:
<a id="{concat($currentId, '_OrgBrowserLink')}" href="/search/pages/orgbrowser.aspx?accountname={string(accountname)}">» <xsl:value-of select="$ViewHiearchyLabel" /></a>
The above code works fine. I find I am having problems adding the search results querystring parameter though. The parameter is "k".
I find I cannot append the "&" symbol (due to it being a special reserved character most likely). I have tried "%26" but that seems to mess up the accountname parameter before it (I receive a 'user not found' correlation ID error)
I cannot seem to grab the querystring parameter "k" with my limited knowledge of how xsl works. Could someone enlighten me?
Thanks all
Upvotes: 0
Views: 3388
Reputation: 3503
Unfortunately, the People Search Results web part does not pass the current url as a parameter. It does, however, pass several other URL parameters that do contain the current query string. So the solution is to use one of those, parse out the value in the 'k' parameter and append it to the URL.
I used the $NameSortUrl XSL parameter.
I parsed out the value of the 'k' parameter by using the substring-before and substring-after functions and saving the value in a variable:
<xsl:variable name="kVal" select="substring-before(substring-after($NameSortUrl, 'k='), '&')"/>
I then appended this value to the url like this:
<a id="{concat($currentId, '_OrgBrowserLink')}" href="/search/pages/orgbrowser.aspx?accountname={string(accountname)}&k={$kVal}">
Note the use of HTML encoding to get the ampersand in the url (&).
Hopefully this is useful to someone else in the future.
Upvotes: 1