Last active
January 20, 2016 21:40
-
-
Save vgrem/4773280 to your computer and use it in GitHub Desktop.
Custom Sort Options for People Search Results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:template name="GetCustomSortResultUrl"> | |
<xsl:param name="NameSortValue"/> | |
<xsl:value-of select="concat(concat(concat('peopleresults.aspx?k=',$QueryFromUrl),'&v1='),$NameSortValue)"/> | |
</xsl:template> | |
<xsl:template name="CustomSortOptions"> | |
<xsl:param name="NameSortValues" select="$CustomNameSortValues"/> | |
<xsl:param name="NameSortLabels" select="$CustomNameSortLabels"/> | |
<xsl:param name="separator" select="','"/> | |
<xsl:choose> | |
<xsl:when test="not(contains($NameSortValues, $separator))"> | |
<xsl:if test="string-length($NameSortValues) > 0"> | |
<xsl:variable name="NameSortUrl"> | |
<xsl:call-template name="GetCustomSortResultUrl"> | |
<xsl:with-param name="NameSortValue" select="$NameSortValues"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:element name="option"> | |
<xsl:attribute name="value"> | |
<xsl:value-of select="ddwrt:EnsureAllowedProtocol(string($NameSortUrl))"/> | |
</xsl:attribute> | |
<xsl:if test="$NameSortValues = $V1FromUrl and string-length($HsFromUrl) = 0"> | |
<xsl:attribute name="selected">selected</xsl:attribute> | |
</xsl:if> | |
<xsl:value-of select="$NameSortLabels"/> | |
</xsl:element> | |
</xsl:if> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:variable name="NameSortUrl"> | |
<xsl:call-template name="GetCustomSortResultUrl"> | |
<xsl:with-param name="NameSortValue" select="substring-before($NameSortValues, $separator)"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:element name="option"> | |
<xsl:attribute name="value"> | |
<xsl:value-of select="ddwrt:EnsureAllowedProtocol(string($NameSortUrl))"/> | |
</xsl:attribute> | |
<xsl:if test="substring-before($NameSortValues, $separator) = $V1FromUrl"> | |
<xsl:attribute name="selected">selected</xsl:attribute> | |
</xsl:if> | |
<xsl:value-of select="substring-before($NameSortLabels, $separator)"/> | |
</xsl:element> | |
<xsl:call-template name="CustomSortOptions"> | |
<xsl:with-param name="NameSortValues" select="substring-after($NameSortValues, $separator)"/> | |
<xsl:with-param name="NameSortLabels" select="substring-after($NameSortLabels, $separator)"/> | |
<xsl:with-param name="separator" select="','"/> | |
</xsl:call-template> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment