Copied to clipboard

Flag this post as spam?

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

  • Iulia Maria Jensen 40 posts 71 karma points
    Mar 25, 2013 @ 16:40
    Iulia Maria Jensen

    Search in two different nodes



    I have the following setup: 


    --pages and subpages of site1


    --pages and subpages of site2

    Shared content

    --nodes used by borh Site1 and Site2


    How can I set up my xslt search so that it searches both thorugh Site1 and Shared content but not through Site2?

  • Chriztian Steinmeier 2741 posts 8406 karma points MVP 6x admin c-trib
    Mar 25, 2013 @ 17:39
    Chriztian Steinmeier

    Hi Iulia,

    Here's the basic way of doing that:

    Set up variables for the various sections:

    <!-- Absolute root of Content section -->
    <xsl:variable name="root" select="$currentPage/ancestor::root" />
    <!-- Find each section by its @id (could just as easily be by @nodeName or something else) -->
    <xsl:variable name="site1Nodes" select="$root/*[@id = SITE1_ID]//*[@isDoc]" />
    <xsl:variable name="site2Nodes" select="$root/*[@id = SITE2_ID]//*[@isDoc]" />
    <xsl:variable name="sharedNodes" select="$root/*[@id = SHARED_ID]//*[@isDoc]" />

    - Then find the section in XSLTsearch.xslt where the search template is called and basically do this (the pipe character joins node sets):

    <xsl:call-template name="search">
        <xsl:with-param name="items" select="$site1Nodes | $sharedNodes" />



  • Iulia Maria Jensen 40 posts 71 karma points
    Mar 26, 2013 @ 08:53
    Iulia Maria Jensen

    Thanks Chriztian! I'll try that.

Please Sign in or register to post replies

Write your reply to: