Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Max Mumford 266 posts 293 karma points
    Jul 11, 2011 @ 16:26
    Max Mumford

    Show Property Name of context where search term was found


    I want to modify XSLTsearch to show the name of the property in which the search term was found. E.g. if the search term "umbraco" was found in the property with alias "bodyText" and name "Content", I want the results output to be:

    • In "Content": blah blah blah umbraco blah blah blah...
    instead of
    • Context: blah blah blah umbraco blah blah blah...
    What is the name of the variable that would contain this information so I can edit the xslt file's output?

  • Douglas Robar 3570 posts 4671 karma points MVP 6x admin c-trib
    Jul 11, 2011 @ 17:16
    Douglas Robar

    Hi, Max,

    It isn't simply a one or two line change. Basically, I would look at and re-factor the displayFieldText template in the /app_code/xsltsearch.cs file to become two steps. First is return the field the search term is found in (so you can save it as a variable and display it in your output). Then pass that field into another template to return the same thing as now is returned in the displayField variable (which you'll find around line 350)

                    <xsl:variable name="displayField">
                      <xsl:call-template name="displayFieldText">
                        <xsl:with-param name="item" select="."/>
                        <xsl:with-param name="fieldList" select="$previewFields"/>

    Have fun and good luck.




  • Max Mumford 266 posts 293 karma points
    Jul 13, 2011 @ 13:44
    Max Mumford

    Thanks Doug, I will come back to this problem and update this thread sometime in the future.


Please Sign in or register to post replies

Write your reply to: