Come work for Umbraco - The Umbraco HQ are hiring Project managers, .NET developers and DevOps people!
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?
Looks like you just need to add the currentPage parameter to the mix:
select="$currentPage/ancestor-or-self::root//node[data[@alias = 'FeatureInFrontRotater'] = '1']"
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' ]">
Perfect! Thanks Finn.
Chriztian, I had tried that earlier with no luck. Not sure if I did something wrong. But it didn't work.