<xsl:for-each select="$currentPage/descendant::*[@isDoc][not(umbracoNaviHide = 1)][string(articleFrontpageLink) = '1']"> do something </xsl:for-each>
Here, it looks through EVERY descendant of current page, except if umbracoNaviHide is set to 1 and "articleFrontpageLink" is set to 1. Note umbraconavihide is a boolean and a default umbraco value. "articleFrontpageLink" is my own custom property.
But anyway, in context, this is used to display a list of "editor's choice" articles. If a document is an article of focus, the writer checks the "articleFronpageLink" and it is displayed on the front page.
Hmm... Thats odd it SHOULD work. In the meantime i simply suggest a workaround. Ive done something similar but in a "when" with a picture. If the picture is empty replace it with a stock image.
Well, either you have to do a workaround of sorts, or see if anyone here has a better solution, which im sure there is.
List Nodes based on it's children having a specific value.
I'll try and keep the question simple if you need any more details just ask but just looking for a pointer.
Generally how would I list nodes based on if any thier children had a specific value...
in natural language it would be something like
select all months if any of the articles in the month had a value called show set to yes
How would that look in side a for-each select statement ?
Cheers
Doogie.
something like this:
Here, it looks through EVERY descendant of current page, except if umbracoNaviHide is set to 1 and "articleFrontpageLink" is set to 1. Note umbraconavihide is a boolean and a default umbraco value. "articleFrontpageLink" is my own custom property.
But anyway, in context, this is used to display a list of "editor's choice" articles. If a document is an article of focus, the writer checks the "articleFronpageLink" and it is displayed on the front page.
Aaah basically I have a list of products, some of the products have a saftey data sheet attached.
I only want to list the Product Categories that have products in them with a saftey sheet, I don't want to list the products themselves just yet.
So if the categories were THIS THAT and THE OTHER
THIS and THAT have a couple of products with saftety sheets attached the output would be
This
That
I have used
<xsl:for-each select="$pSource/descendant::*[@isDoc][string(copySafetyDataSheet) != '']" >
But this just lists the actual product nodes not the category nodes !
Hmm... What type is copySafetyDataSheet?
just a media picker.
I can do an if statement in the loop obviously, I was just wondering if I could just call the right data anyway.
Hmm... Thats odd it SHOULD work. In the meantime i simply suggest a workaround. Ive done something similar but in a "when" with a picture. If the picture is empty replace it with a stock image.
Well, either you have to do a workaround of sorts, or see if anyone here has a better solution, which im sure there is.
It's a weird one I know. But you led me down the right path... no pun intended.
I have used
<xsl:for-each select="$pSource/*[@isDoc] [descendant::copySafetyDataSheet != '']" >
Which returns the correct parents of the children with data sheets attatched.
Thanks for your help.
is working on a reply...