Copied to clipboard

Flag this post as spam?

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


  • Michael Olsen 17 posts 31 karma points
    Apr 29, 2009 @ 12:57
    Michael Olsen
    0

    XSLTsearch hack

    Im trying to make a simple hack i XSLTsearch.

    I just want to change the variable possibleNodes to be conditional, but how.

    Original
    [code]
    [/code]


    I tried the following - dosent work, how can I get this to work ?

    [code][/code]

  • Daniel Lindstrom 454 posts 271 karma points
    Apr 29, 2009 @ 14:16
    Daniel Lindstrom
    0

    I think there is a missing ] at the end of both select queries in the latter example.

  • Michael Olsen 17 posts 31 karma points
    Apr 29, 2009 @ 14:23
    Michael Olsen
    0

    Hi Daniel,

    Yep, well that was just a typo when I wrote the post. It's there IRL :-) The XSLT in it self should be ok, tag wise.

    Debug:

    Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
    To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function.
    at System.Xml.Xsl.Runtime.XsltConvert.EnsureNodeSet(IList`1 listItems)

  • Daniel Lindstrom 454 posts 271 karma points
    Apr 29, 2009 @ 14:33
    Daniel Lindstrom
    0

    My guess is that you are trying to iterate $possibleNodes later on.

    Try using copy-of instead of value-of in the xsl:choose. You might also have to use msxsl:node-set() around the variable when you iterate it, like this: msxsl:node-set($possibleNodes). Then you also need to add a reference to msxsl at the top of the xslt file (see how it done for msxml and copy that line and change it to msxsl), and also add it to the exclude prefix row.

  • Michael Olsen 17 posts 31 karma points
    Apr 29, 2009 @ 14:56
    Michael Olsen
    0

    Thanks, you right $possibleNodes is iterated later on. Ill try to use node-set, sounds right.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 05, 2009 @ 00:25
    Douglas Robar
    2

    I wrote a blog post on modifying XSLTsearch that should explain what to do.

    http://blog.percipientstudios.com/2009/4/7/customizing-xsltsearch.aspx

    cheers,
    doug.

  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 13:07
    SiKo279
    0

    How can I restrict xsltsearch to a certain level?

    I have this currently in my system:

    -site1

    -site2

    -site3

    -site4 --> in this site I want xsltsearch, but right now it searches all of the content (including site1-3).

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 20, 2009 @ 14:21
    Douglas Robar
    1

    Check the docs for xsltsearch for more details, but the idea is to set the starting or 'source' node when you insert the xsltsearch macro. By default it uses "-1" unless you specify a start node, and -1 means "everything in the content tree". In your case, you would set the start node in the macro's parameters to the id of the 'site4' node.

    In fact, you can create a search page for each of your sites (/site1/search.aspx, /site2/search.aspx, etc.) and restrict the search results to only the nodes within each site by setting the appropriate source node for each search page.

    The macro looks something like this:

    macroAlias="XSLTSearch" 
    source="1041"   <<<<the id of the starting node to search beneath
    searchFields="metaKeywords,metaDescription,bodyText,sideText"
    previewFields="bodyText,sideText,metaDescription"
    searchBoxLocation="NONE"
    previewType="BEGINNING"
    resultsPerPage="5"
    previewChars="255"
    showPageRange="1"
    showOrdinals="0"
    showScores="0"
    showStats="1"

    cheers,
    doug.

  • SiKo279 82 posts 238 karma points
    Aug 25, 2009 @ 10:20
    SiKo279
    0

    Thanks doug. I knew it should be easy. Great piece of functionality you provided!

Please Sign in or register to post replies

Write your reply to:

Draft