Copied to clipboard

Flag this post as spam?

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


  • Doogie Talons 183 posts 318 karma points
    Nov 25, 2011 @ 13:24
    Doogie Talons
    0

    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.

     

     

  • Frederik T 242 posts 373 karma points
    Nov 25, 2011 @ 13:32
    Frederik T
    0

    something like this:

          <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.

  • Doogie Talons 183 posts 318 karma points
    Nov 25, 2011 @ 13:51
    Doogie Talons
    0

    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 !

  • Frederik T 242 posts 373 karma points
    Nov 25, 2011 @ 13:55
    Frederik T
    0

    Hmm... What type is copySafetyDataSheet?

  • Doogie Talons 183 posts 318 karma points
    Nov 25, 2011 @ 13:59
    Doogie Talons
    0

    just a media picker.

  • Doogie Talons 183 posts 318 karma points
    Nov 25, 2011 @ 14:12
    Doogie Talons
    0

    I can do an if statement in the loop obviously, I was just wondering if I could just call the right data anyway.

     

     

  • Frederik T 242 posts 373 karma points
    Nov 25, 2011 @ 15:40
    Frederik T
    0

    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.

  • Doogie Talons 183 posts 318 karma points
    Nov 25, 2011 @ 16:01
    Doogie Talons
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft