Copied to clipboard

Flag this post as spam?

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


  • Devin 87 posts 251 karma points
    Nov 19, 2013 @ 16:26
    Devin
    0

    True/False ignoring levels

    Hi guys,

    I have an area on my site that has a "Quick Links" box, which grabs a bunch of pages IF the "Quick Link" checkbox is ticked. It works great, but it currently only works if the bottom level node is checked before the sub-nodes.

    Is there a way to ignore levels and just add pages regardless of levels?

    <?xml version="1.0" encoding="utf-8" ?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:umb="urn:umbraco.library"
        exclude-result-prefixes="umb"
    >

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

        <xsl:param name="currentPage" />
        <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />

        <xsl:template match="/">
            <!-- Process all of the heading nodes (1st level below root) -->
            <xsl:apply-templates select="$siteRoot/*[@isDoc][quickLink = 1]" mode="header" >
          <xsl:sort select="@sortOrder" order="ascending" data-type="number"/>
            </xsl:apply-templates>
        </xsl:template>

        <!-- Template for the headers -->
        <xsl:template match="*[@isDoc]" mode="header">
        <!-- Select the sub pages (if any) -->
        <xsl:variable name="subPages" select="descendant::*[@isDoc][quickLink = 1][@level &gt;= 1]" />
     
        <xsl:choose>
          <xsl:when test="$subPages">
          <h1 class="quickLinkTitle">Quick Links</h1>
           <ul>
           <!-- Use the link mode template for the links -->
           <xsl:apply-templates select="$subPages" mode="link">
               <xsl:sort select="@sortOrder" order="ascending" />
            </xsl:apply-templates>
           </ul>
          </xsl:when>
          <xsl:otherwise>
           <h1 class="quickLinkTitle">Welcome to the Green Room</h1>
          </xsl:otherwise>
        </xsl:choose>
                 
    </xsl:template>

        <!-- Template for the links -->
        <xsl:template match="*[@isDoc]" mode="link">
            <li class="quickLinkList">
                <a class="quickLink" href="{umb:NiceUrl(@id)}">
                    <xsl:value-of select="@nodeName" />
                </a>
            </li>
        </xsl:template>

    </xsl:stylesheet>

     

  • Devin 87 posts 251 karma points
    Nov 21, 2013 @ 11:29
    Devin
    0

    Anyone?

Please Sign in or register to post replies

Write your reply to:

Draft