(Migrated post from June 15th, 2007)
Facing the challenge to customize the Content Query Web Part by displaying custom site columns (following the wonderful description of Heater Solomon @ http://www.heathersolomon.com/blog/articles/customitemstyle.aspx) I found a very time-saving “best practices” that you should always follow:
Never use any spaces or even special characters when creating any fields in SharePoint!
Maybe I’m not that good in it, but I haven’t found how to specify these field names as attribute names later in the XSLT transformations and wasted a lot of time. But then I checked how Microsoft handles fields like “Created by” and the like and – oh wonder – they named their fields “CreatedBy” and later changed the name to “Created By”.
So the trick is to do the following:
- Start to create new field (custom field in a list, site column etc.)
- Choose a one-word name such as “PONumber” and save the new field
- Open the field in edit mode again, change the name from “PONumber” to “Purchase Order Number” and save it again.
The internal name used in the webpart definition file as well as in the ItemStyle.xsl is no “PONumber” and you don’t have to deal with complicated esacpings. Good luck!