Web Solutions/Intranets

Spaces in DataView Web Parts

One of the best features of SharePoint and has been for a while has to be the DataView Web Part. This powerful web part allows the user to query for information and display in a whatever way that XSL will allow.
 
I use this web part when it’s cousin, the Content Query Web Part won’t do the trick. Very soon after starting to use it, you will notice that XSL is the power engine behind the display.
In SharePoint, XSL accepts many escaped item (i.e., &gt; for ">" and &lt; for "<"). But one thing it does not like is "&nbsp;" for white space. It will actually break the web part and you will not know what is going on.
 
Luckily in XSL, there is a workaround. Instead of using "&nbsp;" for spaces, simply wrap the text with the spaces in an
<xsl:text disableoutputescaping="yes">…</xsl:text> declaration. This will do the trick. Make sure that the attribute "disableoutputescaping" is set.
 
This little trick will save you tons of time trailing the blogs.

Leave a Reply