Copied to clipboard

Flag this post as spam?

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


  • Alexadar 17 posts 37 karma points
    Nov 19, 2011 @ 17:33
    Alexadar
    0

    Enumerating pages from certain parent

    For example i have multidomain site, and i need to draw navigation for each domain from domain folder. As far as i understanding it, i should search for a nodes in a certain folder with certain name.

    For this purpose i want to write XLST macro what will find a child with certain name on certain level and enumerate all pages, what have this child as parent.

    How can i do this?

    Thank you.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Nov 19, 2011 @ 23:02
    Chriztian Steinmeier
    0

    Hi Alexadar,

    If your setup is something like this:

    Content
    - Website (UK)
      - Home
      - News
      - About
    - Website (RU)
    - Website (FR)

    You can do the following in your macro to get a reference to the top node of the site your currentPage is within:

    <xsl:param name="currentPage" />
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
    <!-- Render navigation within current site -->
    <xsl:for-each select="$siteRoot/*[@isDoc]">
    ... etc.

     

    The siteRoot variable goes back up the tree until it reaches level 1, which is normally the root of a site in a multisite setup.

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft