Copied to clipboard

Flag this post as spam?

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


  • Magnus Jonsson 33 posts 53 karma points
    Aug 27, 2010 @ 16:42
    Magnus Jonsson
    0

    Loop nodes under a specific node

    Hi,

    I'm back with another XSLT question that I'm not able to sort out myself, and I can't find the answer in this excellent forum either. Below is the content tree of the site I'm working on. On the homepage and the pages the level below it ("Pressreleaser", "Kontakta oss" &"Dotterbolag") I would like to have a footer which write outs a property from each of the nodes below "Dotterbolag".

    In my XSLT i tried:

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">

    But this obviously only writes out the nodes below the currentPage and I need to loop nodes below a specific node. So the next thing I tried was:

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@nodeTypeAlias = 'CCDotterbolag']/node">

    As far as my XSLT knowledge goes I assume that the code above is supposed to loop the nodes below the node of Document Type (alias) "CCDotterbolag" which is the Document Type of "Dotterbolag" in the content tree screenshot above.

    I'm stuck and would be thankful for any help on this :)

    //Magnus

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Aug 27, 2010 @ 16:57
    Ali Sheikh Taheri
    0

    try this:(1234 is the id of dotterBloag)

    variable item is the current item in for-each.

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1234)/CCDotterbolag">
    <xsl:variable name="item" select="." />
    </xsl:for-each>

    hope that makes sense

    Ali

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Aug 27, 2010 @ 17:00
    Ali Sheikh Taheri
    0

    I assume that the document type of bolag1 and bolag2 is CCDotterBolag. if it's not. in the first line of xslt change CCDotterBolag to the document type of Bolag1 and bolag2

    Cheers

    Ali

  • Magnus Jonsson 33 posts 53 karma points
    Aug 27, 2010 @ 19:05
    Magnus Jonsson
    0

    Thanks Ali for your reply! Works like a charm :)

    //Magnus

Please Sign in or register to post replies

Write your reply to:

Draft