SharePoint MOSS 2007 - Customizing The Content Query Web Part (CQWP)
If you've used MOSS 2007 to build a basic site or two, you've probably started adding custom columns and content types to document libraries within your site. Using the Content Query Web Part, you can fetch lists of results across your site filtering by your custom content types and custom columns. But then, the displayed results are limited to the presentation styles that come with the CQWP out of the box, which do not include custom columns in the display.
MOSS does support customizations to the CQWP though XML and XSL markup. I used the following steps to successfully modify the CQWP and even added it as an option in the Web Part Gallery without the need to do any compiling or modification to the 12 hive directory.
1) Add the CQWP to a page and export the CQWP as a .webpart xml file
2) Modify the exported .webpart configuration to enable support for your custom columns
3) Import customized .webpart file to create a new CQWP instance on a page
4) Add custom style to /Style Library/XSL Style Sheets/ItemStyles.xsl in SharePoint Designer to render the custom columns
5) Test and repeat as needed to get the output you need
References
How to: Customize the Content Query Web Part by using Custom Properties
Customizing the Content Query Web Part XSL (Examples of XSL date format functions here)
SharePoint Data View Web Part Extension Functions in the ddwrt Namespace
CAML Madness! (my list of CAML quirks you should be aware of)