XSLT organization
As mentioned in the Overview section above, the components comprising the HNWCMS sample application are stored in the HNWCMS folder under the Style Library section within SharePoint's Site Content and Structure browser.
The ContentQueryMain Web Part is rendered using three XSLT files:
| |
· |
header.xsl: Controls how the beginning of the Web Part is presented.
|
| |
· |
ContentQueryMain.xsl: Controls how the body of the Web Part is presented. Here we use a table layout.
|
| |
· |
ItemStyle.xsl: Controls how each item within the table is presented.
|
If you plan to modify the HNWCMS application to meet your requirements, you need only modify the ContentQueryMain Web Part XML file, upload it and modify the corresponding XSLT files as necessary to meet your presentation requirements.
If you plan to use the HNWCMS version of ContentQueryMain to create your own Web Part, follow these steps:
| |
|
|
|
Step
|
|
1
|
Export the ContentQueryMain Web Part's XML file. Give the exported file an appropriate name. Modify the file as needed.
|
|
2
|
Within the XML file, be sure to provide a unique value for the Title property.
|
|
3
|
Copy the header.xsl and ItemStyle.xsl files into your WCMS application.
|
|
4
|
Upload the new Web Part's XML file into your application. Be sure after upload to also click on the Import button at the bottom of the Add New Web Parts panel to bring the Web Part into your application.
|
|
5
|
Configure the new Web Part using SharePoint's visual Web Part configuration panel.
|
| |
|
|
Tip
|
If you wish to rename the XSLT files, you must modify the values of the following properties in the Web Part's XML file:
HeaderXslLink: The path to the new header XSLT, e.g.:
/Style Library/MyApp/MyHeader.xsl
MainXslLink: The path to the new Web Part XSLT, e.g.:
/Style Library/MyApp/MyContentQueryMain.xsl
ItemXslLink: The path to the new item XSLT, e.g.:
/Style Library/MyApp/MyItemStyle.xsl
Xsl: All of the above XSLT files must be listed here using the syntax:
<xsl:import href="/Style Library/MyApp/XSLTFile.xsl" />
|
On the right side of this screen you will find a few other items that are important to controlling the way content is rendered within the application. One of these is portalStyle.css, the Cascading Style Sheet containing the CSS for the entire WCMS application.
| |
|
|
Tip
|
The template definitions for NavigationItem, ChronologyItem and TickerItem, as well as other templates that provide different ways of presenting a list of publications, are stored in the file ItemStyle.xsl. If you would like to modify the content of the ContentQueryMain Web Part to display additional columns containing metadata, remove existing defined columns or modify the values they display, you will need to modify the templates in this file. XSL programming skills are required!
|