Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    May 12, 2011 @ 12:29
    vaibhav
    0

    Showing content of all child pages on one page

    Hi,

    I have one herirchy

    Page 1

    >subpage1

     >>sub1page1

     >>sub1page2

    >subpage2

      >>sub2page1

      >>sub2page2

     

    I want to show all pages under Page 1 on Page 1 with headings as there names & Heirarchy should be mainetained. i.e. pages under subpage 1 should be shown under heading of subpage 1 & so on.

     

    Please help me to do this.

     

  • praveity 100 posts 125 karma points
    May 12, 2011 @ 13:21
    praveity
    0

    <xsl:variable name="homePage" select="$currentPage/ancestor::*[@isDoc and @level = 1]"/>
    <ul>
            <li>
              <xsl:value-of select="$homePage/@nodeName"/>
              
            </li>
            <xsl:for-each select="$homePage/*[@isDoc and @level = 2 and hideInNavigationMenu != 1]">
              <li>
    <xsl:value-of select="@nodeName"/>
                <xsl:if test="count(./*[@isDoc]) &gt; 0">
                    <ul>
                      <xsl:for-each select="./*[@isDoc]">
                        <li>
                            <xsl:value-of select="@nodeName"/>
                        </li>
                      </xsl:for-each>
                    </ul>
                 </xsl:if>
              </li>
            </xsl:for-each>
          </ul>

  • vaibhav 119 posts 139 karma points
    May 12, 2011 @ 15:27
    vaibhav
    0

    Hi,

    I want to showsomthing like this on Page 1

    subpage1

    content of sub1page1

    content of sub1page2

    subpage2

    content of sub2page1

    content of sub2page2

     

    can any 1 help me.

  • Stuart Burrows 61 posts 110 karma points
    May 12, 2011 @ 18:36
    Stuart Burrows
    0

    You could try this:

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


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

    <xsl:param name="currentPage"/>
        <!-- only select children of current page -->
        <xsl:variable name="startPage" select="$currentPage[@isDoc]"/>
        <!-- h level (default = 1 for h1) -->
        <xsl:variable name="headingLevel" select="1"/>
        <!-- max level (default = don't go more than 6 levels (only up to h6)) -->
        <xsl:variable name="maxLevel" select="$headingLevel + 5"/>

    <xsl:template match="/">
      <xsl:call-template name="repeater">
        <xsl:with-param name="parent" select="$startPage" />
      </xsl:call-template>
    </xsl:template>
        
    <xsl:template name="repeater">
      <xsl:param name="parent" />
      <xsl:param name="headingLevel" select="$headingLevel"/>
      
      <xsl:value-of select="concat('&lt;h',string($headingLevel),'&gt;')" disable-output-escaping="yes" />
          <xsl:value-of select="$parent/@nodeName"/>         
      <xsl:value-of select="concat('&lt;/h',string($headingLevel),'&gt;')" disable-output-escaping="yes" />
      
      <xsl:value-of select="./bodyText" disable-output-escaping="yes" />

      <xsl:for-each select="$parent/* [@level &lt; $maxLevel and @isDoc]">
        <xsl:call-template name="repeater">
          <xsl:with-param name="headingLevel" select="$headingLevel + 1"/>
          <xsl:with-param name="parent" select="." />
        </xsl:call-template>
      </xsl:for-each>
                
    </xsl:template>

    </xsl:stylesheet>

    Hope it helps

Please Sign in or register to post replies

Write your reply to:

Draft