Copied to clipboard

Flag this post as spam?

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


  • Martin 17 posts 24 karma points
    Apr 13, 2010 @ 15:24
    Martin
    0

    Changing source node - Bug in XSLTSearch?

    Hi

    I tried changing the $source node by making a little modification to XSLTSearch.

    I wanted the search to take place in all child nodes of the currently selected level 1 node. So I changed this

    <xsl:variable name="source" select="string(ps:getParameter(string(//macro/source), '-1'))"/>

    to this

        <xsl:variable name="source">
            <xsl:value-of select="string($currentPage/ancestor-or-self::node [@level=1]/@id)"/>
        </xsl:variable>

    However, this did not work.

    I also had to change this line:

    <xsl:with-param name="items" select="./descendant-or-self::node"/>

    to this

    <xsl:with-param name="items" select="umbraco.library:GetXmlNodeById($source)/descendant-or-self::node"/>

    As far as I can see the . in the original line means that the search should take place on the search page itself and all it's childs, if any.

    Is this a bug in XSLTsearch or do I misunderstand something? :S

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 13, 2010 @ 21:46
    Jan Skovgaard
    0

    Hi Martin

    Maybe the solution is to simply write this in the first variable

    <xsl:variable name="source" select="string(ps:getParameter(string(//macro/source), $currentPage/@id))" />

    Then I think XSLTsearch will only return results from the current node and it's children.

    Could this be the solution?

    /Jan

  • Martin 17 posts 24 karma points
    Apr 19, 2010 @ 14:50
    Martin
    0

    I have no problem making XSLTSearch search through the search page and all of its child nodes.

    It does this by default and, as I write, I think that it is a bug.

    More specifically it is the "." (dot) in this line

    <xsl:with-param name="items" select="./descendant-or-self::node"/>

    that should be changed to "umbraco.library:GetXmlNodeById($source)" so the line looks like this in stead:

    <xsl:with-param name="items" select="umbraco.library:GetXmlNodeById($source)/descendant-or-self::node"/>

    THEN it searches in the node specified in the "source" parameter and all of it's child nodes - but not until the fix above has been made.

Please Sign in or register to post replies

Write your reply to:

Draft