x First time here? Check out the FAQ
  • Avatar162posts217karma

    Select all nodes with a specific property

    rasb started this topic November 29, 2009 @ 08:30, Go directly to the topic solution

    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?


  • Avatar2385posts6642karma2015 MVP
    adminMVPComment with ID: 20389
    Chriztian Steinmeier posted this reply November 29, 2009 @ 09:13

    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 posted this reply November 29, 2009 @ 09: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' ]">


  • Avatar162posts217karma
    Comment with ID: 20403
    rasb posted this reply November 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 login or Sign up To post replies