Copied to clipboard

Flag this post as spam?

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


  • adrianfriend 67 posts 68 karma points
    Jul 29, 2009 @ 11:18
    adrianfriend
    0

    Random @nodeName not @id

    Hi guys,

     

    I coded some XSLT to get random nodes but the client now has duplicate pages under different sections but still want to randomise. This means that just using standard randomisation on the node IDs will now not work as the @nodeName will be the same (duplicated content). Is there a way that anyone has implemented to make sure the @nodeNames are unique in the list.

    Cheers,


    Adrian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 29, 2009 @ 21:54
    Jan Skovgaard
    0

    Hi Adrian

    The duplicated nodes you are mentioning - is it just the name of the nodes that are duplicate or is it both name and content?

    And is it possible for you to reference to the site where we can see the problem in action? I think that would make it easier to give you some suggestions maybe.

    /Jan

  • adrianfriend 67 posts 68 karma points
    Jul 30, 2009 @ 09:56
    adrianfriend
    0

    HI Jan,

    It is name and content but I am just listing the node names out. The schema is

    Advice Type > Advice Topic > Article

    Articles can be duplicated between Advice Types & Advice Topics. The clients wants a random list of 5 articles shown on the home page (from all Advice Types/Advice Topics) but because they want Articles to be duplicated between these there will be duplicates if I just use the node id as the randomisation seed.

    Hope that makes sense!

    Adrian

  • Tommy Poulsen 514 posts 708 karma points
    Jul 30, 2009 @ 10:18
    Tommy Poulsen
    1

    Hi Adrian,you could use different approaches I guess. Examples could be:

    1. Create a nodeset of your nodesets and use sorting/grouping functionality to find only unique ones (see e.g. grouping examples here: http://blackpoint.dk/umbraco-workbench.aspx?Snippet=/umbraco-workbench/xslt/grouping--distinct-values.aspx

    2.You could do something with keeping the random titles of the articles found so far in a list, and then checking the list every time you find a new random node (see e.g. here for input on checking/splitting lists http://forum.umbraco.org/yaf_postst9763_Getting-a-unique-list-from-comma-separated-values-in-xslt.aspx

     

    >Tommy

     

  • adrianfriend 67 posts 68 karma points
    Jul 30, 2009 @ 11:09
    adrianfriend
    0

    thank Tommy. I will have a look at those two examples

Please Sign in or register to post replies

Write your reply to:

Draft