March 29, 2012

SharePoint Designer: Search Web Part ‘Use Location Visualization’ breaks layout of search results

Problem

When using people search results web part, and wanted to modify the look and feel of the search results, one needs to uncheck the “Use Location Visualization” setting in Web Part properties.

image

When Location Visualization was checked, search results looked like this:

image

After unchecking the Location Visualization using SharePoint Designer, and without touching the XSL definition, search result looks like this:

image

As you can see, layout is far from what it should be.

Thoughts

Comparing the HTML of the two scenarios one can see that ID’s of several elements used in search results are different.

In correct layout scenario, IDs look like this:

image

However, in the broken scenario, IDs have some strange string appended to them:

image

Solution

As you might have guessed from my subtle highlighting, SharePoint Designer is causing this. When you uncheck the “Use Location Visualization” and save the page in SPD, SPD apparently notices that you have xsl:for-each loop that will end up in having multiple HTML elements with same ID. It then modified the ID fields and appends a generate-id() function to them.

image

You have two options:

  1. Only uncheck the “Use Location Visualization” using a browser and don’t modify the page with SPD after that.
  2. Modify the XSL after SPD has modified it and replace generate-id() with your custom variable, say $SPDRules, and define that as a parameter together with other parameters at the top of your XSL: <xsl:param name="SPDRules" />.

 

Technorati Tags:

No comments:

Post a Comment