Welcome to my blog, stay tunned :


Localizing XSL with the Business Data and the Content Query Webparts


Recently, one of my colleagues asked me a question about how to localize XSLT files in SharePoint when there are in use with the Business Data List Webpart. He already tried to use the techniques mentioned here:


and here:


Localization in SharePoint XSLT files used by custom field types


If like me, you wonder how you can localize your SharePoint XSLT files, the ones you use in your custom field types and/or in your lists, here is how it works:

- You need to have a resource file, so for instance MyResource.resx, MyResource.en-US.resx and MyResource.fr-FR.resx
- You must deploy those resource files to the App_GlobalResources folder of the corresponding IIS web application. Now, you can easily do that with the new packaging mechanisms since SharePoint WSPs are now able to deploy directly in the web app folders.

- When those pre-requisites are respected, you can just use this:

<script language="JavaScript">
alert(']]><xsl:value-of select="$thisNode/../@resource.YourResourceFile.TheKey"/><![CDATA[';

in the "body" mode of your custom field type

and this, in the "header" mode of your custom field type:

<script language="JavaScript">
alert(']]><xsl:value-of select="$Rows/@resource.YourResourceFile.TheKey"/><![CDATA[');

This will grab the value of the key in the relevant resource file corresponding to the culture of the current web.

Happy Coding

SharePoint 2010 - Implementing a custom header pattern via XSL for a custom field type


If you wonder how to implement a custom header pattern in XSL for a custom field type in either SharePoint Foundation or SharePoint Server, here is an example that you can download showing how to do.

In this little example, we'll implement a custom field type inheriting from Text that will show the number of entries having that same value within the list. You could achieve this by creating a view that groups the elements on that field & shows the totals but this is just to show an example :).

So, here is a screenshot of the functionality

When you click on the value contained in that specific column, you get an alert message showing you how many items in the list have the same value for that column. In this example, when you click on value 1, you get 2 since two rows contain this value as shown below:

SharePoint custom field type + XSLT rendering


As you know already, SharePoint 2010 uses an XSLT engine to render views & custom field types. You can still use CAML views but it defaults to XLST.

I've just built a custom field type whose the parent type was "Choice". While building the corresponding XSLT, I didn't find the "mode" I was supposed to use...So, in case, the same story happens to you, an easy way to know which mode you're supposed to use is to examine the out-of-the-box file delivered with any SharePoint installation.

I'm talking about this file: