Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3921 karma points c-trib
    Jan 13, 2010 @ 01:26
    Dan
    0

    Get distinct values of a field in all nodes within a specified node

    Hi,

    I'm still only a real newcomer to XSLT, so I'm not sure if this is even possible, but I'm trying to pick out all distinct values from a particular text field in all page nodes within a certain containing page node, and then display these in a list.

    Firstly, is this possible?  Secondly, if so, can someone point me in the right direction to do this as I can't find any XSLT templates which do anything like this?

    Thanks!

  • Paul Blair 466 posts 731 karma points
    Jan 13, 2010 @ 01:44
    Paul Blair
    0

    Hi,

    I've just googles "XSLT Distinct" and it comes up with a lot of results.

    Something like this would do the trick:

    http://are.ehibou.com/xslt-xpath-selecting-distinct-nodes/

    If you're new XSLT you might have difficulty applying this to your situation. If that is the case add some detail on your site/node structure and someone should be able to help.

    Cheers

    Paul

  • Evan Jardine 108 posts 168 karma points
    Jan 13, 2010 @ 02:51
    Evan Jardine
    2

    Hi Dan

    One way I do it is with the following xslt variable;

    <xsl:variable name="uniquelist" select="$currentPage//data [@alias = 'myDocTypeAlias'] [not(.=preceding::data [@alias = 'myDocTypeAlias'])]"/>

    This works for my node structure but may need to be tweaked for yours.

    Cheers

    Evan

  • Darryl Godden 145 posts 197 karma points
    Apr 13, 2010 @ 13:58
    Darryl Godden
    0

    Evan I can't add Karma yet, but just to let you know your solution to the OP helped me immensely - thank you!

Please Sign in or register to post replies

Write your reply to:

Draft