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.
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.
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.
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
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
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
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
thank Tommy. I will have a look at those two examples
is working on a reply...