Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

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 217 karma points
    Nov 29, 2009 @ 20:30

    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?


  • Chriztian Steinmeier 2613 posts 7620 karma points admin mvp c-trib
    Nov 29, 2009 @ 21:13
    Chriztian Steinmeier

    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']"


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

    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' ]">


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

    Perfect! Thanks Finn.

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


Please Sign in or register to post replies

Write your reply to: