Modifying a page in SharePoint 2010 breaks the XML Viewer WebPart

In SharePoint 2007 it was a known fact that when you edit a page with SharePoint designer, unexpected behavior could occur after saving it! Extra tags in your MasterPage, PageLayout and style references you don’t want..

I now have come to the conclusion that this hasn’t changed in SharePoint 2010.

Place an XML Viewer WebPart on a SharePoint 2010 page, edit the XSL for that WebPart(For instance: Display a RSS Feed)  and save the page.

When you now open that same page with SharePoint designer, do some adjustments on listviews, dataviews or change a random property on that page, save it, the XML Viewer WebPart is broken!

What happens?

After editing the page with SharePoint Designer some extra “enters”(CR) are put in the XSL of the XML Viewer WebPart and thus the WP is not displaying anything anymore…

Original:

image

After SPD:

image

Which results in a XML Viewer WebPart not displaying the requested results anymore..

image

“Solution/Workaround”:

Put your XSL Style Sheet in a separate file on the SharePoint site, and refer to that file from the XML Viewer WebPart so that SharePoint Designer cannot screw up the XSL anymore..

image

XML Viewer WebPart displaying some random RSS Feed.. (oh I don’t drink Heineken btwKnipogende emoticon)

image

Advertenties

Display RSS feed with a XML Viewer WebPart in SharePoint Foundation

If you are working with SharePoint foundation and you would like to display an rss feed, for SharePoint Server you would choose to use the rss-viewer WebPart. In SharePoint Foundation there is no RSS-Viewer WebPart so you have to come up with an alternative.

From a customer I received the following request: They wanted newsfeeds from branch organizations all over the world combined into one rss feed and display that one on their corporate marketing portal. For the combine functionality I used “yahoo pipes”. It is an easy interface, with all options you need such as filtering, sorting etc. Once you created a pipe there is also a combined rss feed available that will show you all separate feeds into one.

To display that newly created rss feed, just put a XML-Viewer WebPart on your page in SharePoint 2010, add the url to the combined rss feed at yahoo. If you would hit enter now, the WebPart will display all properties the rss feed outputs. That is unreadable!

To make it readable you need to add some XSL formatting, for example enter the next code at your “XSL Editor”.

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:param name="TITLE"/> <xsl:template match="rss"> <div style="background:#ffffff; padding:0; font-size:10px;"> <xsl:for-each select="channel/item"> <a href="{link}" target="_new"><xsl:value-of select="title"/></a><br/> <xsl:value-of disable-output-escaping="yes" select="description"/><br/> </xsl:for-each> </div> </xsl:template> <xsl:template match="description"><xsl:value-of select="."/><br/></xsl:template> </xsl:stylesheet>

Voilà, you have an alternative RSS-Viewer WebPart!