Disable Output Escaping in XSL

Really, just a reminder for myself, but if you work with SharePoint long enough you’re bound to end up using something like the Content Query Web Part or a Data View Web Part to aggregate and output a rich text source – but all your HTML gets escaped, so it appears content on the page.

The command you want is DisableOutputEscaping:

<xsl:value-of select="somevalue" disable-output-escaping="yes" />

This will cause the HTML to be output unescaped – i.e. as HTML.

Side note: Sometimes people want things like the CQWP to show the first part of the content as a ‘summary’. This trucating content to display in the CQWP or DVWP is difficult; either a) you risk having unfinished tags in the HTML you do emit, or b) you have to strip out all HTML, which can ruin your formatting. a) is a particular problem, as unfinished <table> tags can cause all sorts of weirdness on page.

My preferred option is to have a additional ‘summary text’ box that accepts plain text, and have the author generate the summary manually. That way we avoid outputting HTML like that entirely.

Disable Output Escaping in XSL

More about frozen panes…

So, I’ve been working with ‘Frozen’ panes in tables in HTML. The problem is, some of these tables are, well, a little big. Like maybe 100 cells square. I found that the technique mentioned earlier in my blog didn’t work very well, as the scrolling on the DIV tag became slow and jerky.

This makes sense really – each cell is having it’s CSS rerun each time. Then it struck me – the styles were defined as:

td.frozen {
padding: 3px;
position:relative;
top: expression(document.getElementById('pane').scrollTop-2); /*IE5+ only*/
z-index: 5;
}

This mean that ‘getElementById’ was being run repeatedly. However, the style’s JavaScript was being run before ‘onload’. I just couldn’t run the ‘getElementById’ to populate a global variable after the element had been created, but before the style expressions were run. Instead, in a moment of clarity, I changed the style to:

td.frozen {
padding: 3px;
position:relative;
top: expression(getPane().scrollTop-2); /*IE5+ only*/
z-index: 5;
}

And added a script:

var pane;

function getPane() {
if( pane == null ) {
pane = document.getElementById(“pane”);
}
return pane;
}

Thus, we only run getElementByID once – the first time a CSS style’s javascript expression is run. This worked – the DIV tag now scrolls much more quickly, certainly not so as users will notice any lag.

More about frozen panes…