Copied to clipboard

Flag this post as spam?

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


  • aradhya 11 posts 30 karma points
    May 11, 2010 @ 13:46
    aradhya
    0

    Looping through different nodes in XSLT

    Hi,

     

    I have contents in the following fasion

    content
       Page1
       Page2
       Page3
       Page4

    content which comes by default in content menu.

    I want to loopthrough all the pages (page1, page2,page3, page4..............) to list from the xslt.

    Can anyone please help me how can I do this?

     

    Regards,

    aradhya

      

  • Dan 1288 posts 3921 karma points c-trib
    May 11, 2010 @ 13:52
    Dan
    2

    Hi,

    If you right click the 'XSLT Files' folder in the developer section and select 'create', you should be able to choose an XSLT template which does what you need.  It sounds like the one you want is 'List sub pages by level', which will output something like 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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

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

    <xsl:param name="currentPage"/>

    <xsl:variable name="level" select="2"/>

    <xsl:template match="/">

    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft