Copied to clipboard

Flag this post as spam?

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


  • rasb 162 posts 218 karma points
    Nov 29, 2009 @ 20:30
    rasb
    0

    Select all nodes with a specific property

    Hi guys,

    I want to display certain featured pages on the homepage. I have created a true/false property with which I can toggle whether a page is featured on the homepage.

    These nodes can exist anywhere in the tree. So I would like to know how I can easily select all nodes that have this property set, so I can just loop through them, and read all other properties such as name, url and a short description.

    This does not work:

    select="//node [string(data [@alias='FeatureInFrontRotater']) = '1']"

    Any suggestions on how to make it work?

    Thanks,
    RasB

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Nov 29, 2009 @ 21:13
    Chriztian Steinmeier
    0

    Hi rasb,

    Looks like you just need to add the currentPage parameter to the mix:

    select="$currentPage/ancestor-or-self::root//node[data[@alias = 'FeatureInFrontRotater'] = '1']"

    /Chriztian

  • Finn 86 posts 50 karma points
    Nov 29, 2009 @ 21:23
    Finn
    1

    Hi rasb

    This line of code finds excatly what you need no matter where in the structure its placed.

    <xsl:for-each select="umbraco.library:GetXmlAll()/descendant-or-self::node [string(data[@alias='FeatureInFrontRotater']) = '1' ]">

    /Finn

  • rasb 162 posts 218 karma points
    Nov 30, 2009 @ 10:37
    rasb
    0

    Perfect! Thanks Finn.

    Chriztian, I had tried that earlier with no luck. Not sure if I did something wrong. But it didn't work.

    /RasB

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies