Search code examples
asp.netsharepointxsltdataformwebpart

Using regular expressions in the Search Core Results web part XSLT


The Search Core Results SharePoint web part uses XSLT 1.0 to transform search results for display. I would like to manipulate some of the result text using regular expressions. Alas, XSLT 2.0 (containing regular expression support) is not available and Microsoft don't currently plan to implement it!

One thought was to override the web part but it inherits from the DataFormWebPart and methods relating to executing the transform are marked private. So I've had to rule that out.

I hoped to use EXSLT and copy and paste the functions I needed if necessary. However this doesn't appear to be an option either as according to this post, msxsl:script blocks are not available due to the security settings used in the web part.

So everything I can think of has been blocked now. :) Has anyone else been able to enable this functionality?


Solution

  • You may be brave enough to create your own results webpart, inheriting from Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.

    I have never done this, so I would not do it unless you are really keen to have regex in your results.