Copied to clipboard

Flag this post as spam?

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


  • Niklas Hjelm 104 posts 125 karma points
    May 07, 2011 @ 18:10
    Niklas Hjelm
    0

    Exlude null templates from xslt search

    Hi

    I'm using some pages as placeholders and want to exlude these from my search result.

    Snippet from xslt search

        <!-- reduce the number of nodes for applying all the functions in the next step -->
        <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())
                               ]"/>

    When I run the search and place <xsl:value-of select="@template"/> after the description I get a value of 0 (zero). Which is perfect since my placeholder pages does not have any templates. Is there a way to use this in the above snippet using something like

    and @template = 0

    Thanks!

    / Niklas


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 07, 2011 @ 18:16
    Jan Skovgaard
    0

    Hi Niklas

    Isn't just a matter of using the "umbracoNaviHide" on your placeholder document types? That should exclude them from the results.

    /Jan

  • Niklas Hjelm 104 posts 125 karma points
    May 07, 2011 @ 18:24
    Niklas Hjelm
    0

    Hi Jan

    Yes that would work and I started doing that at first but then I realized I would have to to go through over 2000 pages which seemed a bit tedious :)

    / Niklas

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 08, 2011 @ 09:20
    Jan Skovgaard
    0

    Hi Niklas

    Ok, then I guess it's matter of altering the variable to look like this

      <xsl:variable name="possibleNodes" select="$items/descendant-or-self::*[
                                
    @isDoc
                                 and @template = 0
                                 and string(umbracoNaviHide) != '1'
                                 and count(attribute::id)=1
                                 and (umbraco.library:IsProtected(@id, @path) = false()
                                  or umbraco.library:HasAccess(@id, @path) = true())
                               ]"/>

    Hope this helps.

    /Jan

  • Niklas Hjelm 104 posts 125 karma points
    May 09, 2011 @ 09:28
    Niklas Hjelm
    0

    Hi Jan

    I'm afraid this didn't do the trick. Any more ideas?

    Regards / Niklas

Please Sign in or register to post replies

Write your reply to:

Draft