none
How to show serial no of results in core result web part across pages. RRS feed

  • Question

  • Here, I have defined a parameter variable which calculates threshold value which must be added to "id" value of each result to get required serial number. For this, we are using “ViewInBrowserReturnUrl”, one of default parameter variable of core result web part. Add following tag below existing parameter tag in core result web part.

    <xsl:param name="StartValue">

            <xsl:variable name="currentUrlstartindex" select="substring-after($ViewInBrowserReturnUrl,'&#37;26start1&#37;3D')"/>

            <xsl:choose>

                <xsl:when test="string-length($currentUrlstartindex) &gt; 0">

                    <xsl:choose>

                        <xsl:when test="contains($currentUrlstartindex,'&#37;26')">

                            <xsl:value-of select="substring-before($currentUrlstartindex,'&#37;26')-1"/>

                        </xsl:when>

                        <xsl:otherwise>

                            <xsl:value-of select="number($currentUrlstartindex)-1"/>

                        </xsl:otherwise>

                    </xsl:choose>

                </xsl:when>

                <xsl:otherwise>

                    <xsl:value-of select="0"/>

                </xsl:otherwise>

            </xsl:choose>

        </xsl:param>

    Now, below match result template(<xsl:template match="Result">) and declare a new variable “resultNo” as follows.

    <xsl:variable name="resultNo" select="$StartValue+id"/>

    We can use this variable, as “<xsl:value-of select="$resultNo"/>” to display serial no in search result against each item which will work across pages.

    Hope, this is useful.  

    Also, if someone has any alternate solution, please reply.

    Thanks and Regards.

    Umashankar.


    umashankar

    Tuesday, December 11, 2012 2:26 PM