Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Jan 17, 2011 @ 15:03
    dominik
    0

    Look for dropdown value inside the xslt

    hello,

    i created a new document type with a dropdown list with prevalues. The name of the dropdown is "showInFooter" and the values are "Contact, Home, etc"

    Now i want to write a macro where only items are displayed that have got the value "Contact" for example.

    How can this be done?

    Thanks

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 17, 2011 @ 15:11
    Dirk De Grave
    0

    Depends on your dropdown configuration, if you're using the "Dropdown list", then the text will be stored in the published xml, if you're using a "Dropdown list, publishing keys", then values will be stored rather than the text.

    <xsl:for-each select="$currentPage/* [@isDoc and showInFooter = 'Contact']">...</xsl:for-each>

    will only display child docs of current page being requested where the value of the dropdown was set to 'Contact'.

     

    Hope this helps.

    Regards,

    /Dirk

  • dominik 711 posts 733 karma points
    Jan 17, 2011 @ 15:14
    dominik
    0

    thanks,

    but i dont need the current page i need all pages with the value "Contact" not only from the current page

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 17, 2011 @ 15:21
    Dirk De Grave
    0

    well, change your select statement to start from top level node...

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level = 1]//* [@isDoc and showInFooter = 'Contact']">...</xsl:for-each>

    Above snippet traverses your xml back to the top level node and then iterates all nodes (regardless of level - hence the double slash) and finds all documents that have a property with a value = 'Contact'

     

    Hope this helps.

    Regards,

    /Dirk

  • dominik 711 posts 733 karma points
    Jan 17, 2011 @ 15:46
    dominik
    0

    ok thanks this is great,

    now i have to count the items and after 5 icons i need to close a div and open a new div. Is this possible?

     

    thanks

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 17, 2011 @ 15:52
    Dirk De Grave
    2

    Oh sure, that's possible, and you'll need some xslt functions such as count(), and some functions to find out current position in a loop (first(), last(), position()). Just make a little effort to write some basic xslt already, and we'll help you out when you're stuck.

     

    Hope this helps.

    Regards,

    /Dirk

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies