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
    0

    Search in two different nodes

    Hi,

     

    I have the following setup: 

    Site1

    --pages and subpages of site1

    Site2

    --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 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 25, 2013 @ 17:39
    Chriztian Steinmeier
    1

    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" />
    </xsl:call-template>
    
    

    /Chriztian

     

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

    Thanks Chriztian! I'll try that.

Please Sign in or register to post replies

Write your reply to:

Draft