Copied to clipboard

Flag this post as spam?

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


  • Philip Panton 2 posts 22 karma points
    Jan 04, 2011 @ 12:36
    Philip Panton
    0

    Search module - Problem with ignoring particular nodes

    Hi,
    I've tried to amend the xslt search module so that it ignores nodes with the doc type 'TextImageData'.
    <xsl:template match="/">
    <!-- determine which nodeset to search through, based on the value (or absence) of the SOURCE parameter in the macro -->
    <xsl:choose>
    <!-- short-circuit the whole searching if no search-text were passed in -->
    <xsl:when test="$search = ''">
    <!-- using NO nodes; only calling the template for the form -->
    <xsl:call-template name="search">
    <!--<xsl:with-param name="items" select="./node[1=2 and name(.) != 'TextImageData']"/>-->
    <xsl:with-param name="items" select="./node[1=2 and name(.) != 'TextImageData']"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:when test="number($source)= -1 or number($source)= 0">
    <!-- using ALL nodes -->
    <xsl:call-template name="search">
    <xsl:with-param name="items" select="umbraco.library:GetXmlAll() [name(.) != 'TextImageData']"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:when test="number($source)=$currentID">
    <!-- using only nodes within the search page's family tree, from top to bottom -->
    <xsl:call-template name="search">
    <xsl:with-param name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1 and name() != 'TextImageData']"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <!-- search only within the SOURCE node specified in the macro and all of its children -->
    <xsl:call-template name="search">
    <xsl:with-param name="items" select="./descendant-or-self::*[@isDoc and @level != 6 and name(.) != 'TextImageData']"/>
    </xsl:call-template>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    None of this seems to work. Any ideas why?
    Thanks for any help,
    Philip

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Jan 04, 2011 @ 16:01
    Sebastiaan Janssen
    0

    You should only add the exception to the possibleNode variable, something like this should do the trick:

        <xsl:variable name="possibleNodes" select="$items/descendant-or-self::*[
                                 @isDoc
                                 and string(umbracoNaviHide) != '1'
                                 and count(attribute::id)=1
                                 and (umbraco.library:IsProtected(@id, @path) = false()
                                 or umbraco.library:HasAccess(@id, @path) = true())
            and local-name() != 'TextImageData'
                               ]"/>
  • Philip Panton 2 posts 22 karma points
    Jan 05, 2011 @ 16:41
    Philip Panton
    0

    Thanks!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies