My career in technology

Small dumb mistake, interesting symptoms.

So I am working on modifying the style on a Content Query Web Part, following the excellent directions by Heather Solomon. The idea is to have a small graphic that was dynamically generated using the Calculated HTML Column in a SharePoint List surfaced to the main page in a CQWP.

I didn’t like the spacing between the graphic and the text in the output, so I made the mistake of adding an   to the xsl. I mean, I am adding an img tag, and an a tag with an href attribute, so I should be able to add a nonbreaking space, right? As I said, dumb.

The interesting thing about it was the result. The page rendered fine (though I still didn’t get the space I was looking for). When I looked at the HTML source for the page, the space wasn’t there (naturally). When I tried to take the page into edit mode, though, I got the following error:

An unexpected error has occurred.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.

What’s more, anyone trying to edit any page in the site got the same error.

Naturally, there were no web parts that were causing the error – closing and deleting web parts from the web parts maintainance page did no good. Naturally, removing the “I-can’t-believe-I-tried-to-use-HTML-special-characters-in-xsl” code resolved the error.

Filed for future reference under “How to prevent anyone from editing pages with a single  “.

Oh, yeah, and to get the space I wanted, I added a nested table with some cell padding, like I was supposed to.  (UPDATE – Alternative solution option in the comments below!)

More posts about SharePoint.

Well, I can dream, can’t I?


Comments on: "Don’t Make This Dumb Mistake When Editing ItemStyle.xsl" (1)

  1. Val Kirshin, over at the LinkedIn group SharePoint 2007 & 2010, commented:

    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

    is your friend. After all, you are editing an XSL document, which conforms to XML spec which in turn does not say anything about HTML-specific entities such as &nbsp;. But I agree with you, it’s often frustrating.

    As I haven’t done enough xsl work to be particularly fluent, I didn’t know the text disable-output-escaping=”yes” trick. Thanks to Val, now I know. And (if you didn’t before), now so do you!


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: