Copied to clipboard

Flag this post as spam?

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


  • Adrian Alexa 50 posts 100 karma points
    Jul 19, 2012 @ 13:12
    Adrian Alexa
    0

    How to display sitemap/navigation for a site using xslt?

    I have a website that has pages and subpages as in the image attached.

    Some of the subpages belong to First pagge(About Patient Direct), they have setted 'do not show in menu'.

    All right I want to make an xslt file that will generate an html content like this:

    Menu Item 1 (including Home page - About Patient Direct)

    -submenu page 1 1

    Menu Item 2 (including Home page - About Patient Direct)

    -submenu page 2 1

    -submenu page 2 2

    This is what I have so far

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
    <div class="column">
    <h1>
    <a href="#">
    Home Page - I don't know what to write here
    </a>
    </h1>
    </div>
    </xsl:if>

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
    <div class="column">
    <h1>
    <xsl:choose>
    <xsl:when test="name() = 'Link'">
    <a href="{current()/linkUrl}" target="_blank">
    <xsl:value-of select="@nodeName" />
    </a>
    </xsl:when>
    <xsl:otherwise>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName" />
    </a>
    </xsl:otherwise>
    </xsl:choose>
    </h1>
    </div>
    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2012 @ 09:01
    Fuji Kusaka
    0

    Hi Adrian,

    If am right you wan to be able to display the whole structure and have the Homepage as well display??

    //fuji

  • Adrian Alexa 50 posts 100 karma points
    Jul 20, 2012 @ 09:07
    Adrian Alexa
    0

    That is correct.

    I have like 3 pages that are created under homepage which have checked property do not show in menu so for me they are like pages under homepage( i don't know other solution) and I have 3 more pages that are under HomePage, they are childs. Two of these 3 pages have pages underneath, too.

    And this sitemap( as I can call it) is part of the footer, so will have to show on each page.

    Thanks a lot, Fuji for your help.

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2012 @ 09:19
    Fuji Kusaka
    0

    When you say you have the 3 pages pages checked is it with property umbracoNaviHide ?

    If so you need to unchecked them to be able to display those Urls.

  • Adrian Alexa 50 posts 100 karma points
    Jul 20, 2012 @ 09:23
    Adrian Alexa
    0

    Yes they are having 'Hide in navigation on Yes' because I don't want them to be part of the menu. I have only 4 pages of Level 1 (including First Page - About Patient Direct)

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2012 @ 09:35
    Fuji Kusaka
    0

    From the picture you posted can you tell us what you want are the urls and page name you want to display in your naviagation? 

    Sorry am a bite confused what you are trying to display here.. :)

  • Adrian Alexa 50 posts 100 karma points
    Jul 20, 2012 @ 09:45
    Adrian Alexa
    0

    This is what the client wants to have in footer

    This image is taken from desgin so the names are not the same as is now. Hoever that doesn't matter.

    This is the structure of the site:

    Now: according to my content, I want a list like this:

    • About Patient Direct with childs bellow 
    1. Program Coverage (this page as you can see in image above has Hide in navigation = yes, so for me means they are childs of About....)
    2. Eligibility
    • Network
    1. About the Patient...
    2. Dentist Search
    • Enroll Now
    • Wellness

    I hope now I was clear enough :)

  • Adrian Alexa 50 posts 100 karma points
    Jul 23, 2012 @ 14:08
Please Sign in or register to post replies

Write your reply to:

Draft