I am using a linked datasource in MOSS to create a dynamic table of contents page based on a metadata associated with files in a document library. The library contains multilookup columns for the following: Audience, Category, Subcategory. Users get to the toc page by clicking from another page to pass the Audience in the query string. The toc page will filter the categories based on Audience.

The categories are displayed using the categories list and then the subcategories are matched to the respective category based on the join.

The original problem was that these were delimited strings. I broke the strings out using a recursive template. Now my problem is removing duplicates. I am able to remove the subcategory if it matches up exactly, but because of the multiple values this almost never happens. Is there a way to do this using xslt or will I need to look into some sort of jquery.

2 Answers
2

It seems like you should stick with XSLT. You are almost there with your template, you just have to remove dupes. What you could within your template is keep track of the categories that have already been passed through your template. For example adding a parameter to your template called AllCategories:

Then you'll be able to stuff a variable full of the text that has already passed through your template. When you emit elements to the DOM, you can check to see if this variable "contains" an existing string. If it does, then simply skip creating an element.

Here's some sample code that I've not tested, but should get you up and running:

Thanks for the insight. I was actually able to get rid of the recusive template using a third join. I will post my solution, though I am sure this would have worked as well. The only thing I am left with is fighting a two column layout on the page when a category doesnt exist, but thats a separate thread.
–
PerplexedMar 15 '12 at 13:10

I think that's where jQuery will be of assistance. Glad you got this sorted out. Looks like a very neat solution!
–
iOnline247Mar 15 '12 at 15:11