CQWP (need the publishing feature enabled, this creates the styles library and add the CQWP) by default uses the xslt /Style Library/XSL Style Sheets/ItemStyle.xsl.
Steps:
- Don't write over ItemStyle.xsl as this si supplied by SP2010 OOTB. Rather create a new xslt and put it into the styles library. Build up the xslt, I based my file on the itemstyle.xsl file, see rules for getting the output you are looking for using How to: Customize XSL for the Content By Query Web Part
- Custom xslt formatting, I always add the following code in case I want to see what the available fields are:
- Deploy the custom style sheet via a feature.
- Create a new Custom list called "Pets" and add columns for Title, Age & Status (choice):
- Edit your custom xslt to display for "Pets" as shown below:
- Add a new CQWP to your page. Configure it to display items from your new list (Pets).
- Change the "Presentation" section, "Item Style" to Show "Pets". Apply the Changes:
- CQWP displays as:
- Edit the CQWP "Age" property to "Age"
- Edit the CQWP "Age" property to "Status"
