fbpx

How to link XSL file to Content Query Web Part for Customization

Home / Blog / How to link XSL file to Content Query Web Part for Customization
Here is a tutorial on how to link XSL file to Content.
1. Create 3 XSL file for the Content Query Web Part
2. Go to Style Library > XSL Style sheets
Make a copy of the 3 existing file called (ContentQueryMain.xsl, Header.xsl, ItemStyle.xsl) to your own folder and rename it accordingly.
3. Insert Content Query Web Part into a page, edit the Web Part and export the Content Query Web Part to your PC and open the file in any text editor.

4. Find for the property :
  • <property name=”MainXslLink”
  • <property name=”ItemXslLink”
  • <property name=”HeaderXslLink”
5. Ā And the link to the 3 XSL file you have made a copy earlier :
  • MainXslLink = ContentQueryMain.xsl
  • ItemXslLink = ItemStyle.xsl
  • HeaderXslLink = Header.xsl
e.g: <property name=”MainXslLink” type=”string”>/Style Library/XSL Style Sheets/Custom/ContentQueryMain.xsl</property>
6. Go to Web Part Gallery from Site Setting and upload the custom Content Query Web Part.
7. Go back to the page that you want to add the custom Content Query Web Part and click edit > insert > Web Part and select the custom Web Part.
8. Now for the styling of this Content Query Web Part we just need to edit the 3 xsl files linked to it. šŸ™‚

 

Leave a Reply

Your email address will not be published.