ItemStyle issues after SharePoint 2013 upgrade (?)

I have a client who is running SharePoint Online, the 2010 version. She sent me an email saying “Help! None of our content query webparts work!” I took a quick look and it was that standard error that the CQWP cannot be displayed. I thought that maybe someone had messed with the ItemStyle.xsl – that’s usually the first place to start troubleshooting.

blogxslt

I tried to log into the environment using SharePoint Designer 2010, considering that’s what I’d always used for this client. She hadn’t gotten the upgrade email from Microsoft yet, but it turned out that I suddenly needed SharePoint Designer 2013 to log in.

That ItemStyle.xsl that I thought had been messed with? It hadn’t been touched in six weeks and the last person to do anything with it was me.

I traced the issue to a section that was being used to aggregate blog posts within the environment. There turned out to be two issues: the strip HTML template I was using was throwing errors and a variable wasn’t working properly.

@Body variable

I saved the template problem for later and tried to figure out why I suddenly wasn’t actually getting any input from the @Body tag.

I made sure “Body” was actually filled into the slot in the CQWP – it was.

I checked to make sure the field really was named “Body” by checking the URL – it was.

I defined it in the XSL so I could call $Body instead of @Body but that didn’t help.

Finally, I used Heather Solomon’s snippet to see which variables were actually being passed to the CQWP:

<xsl:for-each select="@*">
 P:<xsl:value-of select="name()" />
</xsl:for-each>

It turned out that it suddenly Body was called body. That makes a difference in XSLT. I replaced @Body with @body and suddenly I had data to work with again.

Remove HTML template

I finally traced the issue to a template I was using to strip the HTML from the Body field. I had used Ben Prins’ Remove HTML markup in Content Query Web Part, which had worked fine – until it suddenly didn’t.

I replaced the “removeMarkup” template with the one from Maulik Dhorajia’s Removing HTML tags using XSLT. And suddenly it all worked.

I went through the code of the two templates and I can’t really see much of a difference – it seems to come down to the order and structure of how things are called in the code. Then again, I’m not really a developer.

Lessons learned

  • I think Microsoft has done some underwater upgrades to some SharePoint Online environments which suddenly require the use of SharePoint Designer 2013
  • There must be some differences in the XSLT rendering between SharePoint 2010 and SharePoint 2013

One response

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s