SOLVED

Use custom XSL for the default view of a list (Allitems.aspx)

Copper Contributor

I was able to successfully add a custom xsl to the webpart and render it the way I wanted. (I borrowed the example from here: http://mundrisoft.com/tech-bytes/how-to-customize-list-view-web-part-using-custom-xslt-in-sharepoint...)

 

While it is easier me to input the link to a web part by specifying the URL to the XSL Link field in the web part properties panel, it doesn't seem to be straight forward for a list page.

My goal is to to apply the same XSL file to the list view even when user clicks the title of the web part and goes to the actual list view (Allitems.aspx).

 

I opened up Allitems.aspx in SPD, and found the following tag -

<XslLink Default="TRUE">main.xsl</XslLink>

Could I / Should I simply change he main.xsl to my custom file to meet the goal? Something like -

<XslLink Default="TRUE">/mySharePoint/customeXSLT/myXSLT.xsl</XslLink>

 

Just would like to get some confirmation before I actually test it and break things

3 Replies
best response confirmed by Yihuan Liu (Copper Contributor)
Solution

I personally wouldn't touch SharePoint Designer for this when it can mostly be achieved through the SharePoint GUI.

 

If you navigate to your list view page, you will be able to edit the page and it will behave exactly like a normal web part page. You'll see the List View Web Part on the page which you can bring up the web part properties for. Then in the Miscellaneous group, you'll see XSL Link where you can apply your already existing XSL file.

 

At least doing it this way, if you need to reverse the change you can edit the web part again and remove the XSL reference, whereas doing it through SharePoint Designer can often lead to "funnies".

Works great! I almost forgot that the list on the actual list view page is also a web part. Thanks.

1 best response

Accepted Solutions
best response confirmed by Yihuan Liu (Copper Contributor)
Solution

I personally wouldn't touch SharePoint Designer for this when it can mostly be achieved through the SharePoint GUI.

 

If you navigate to your list view page, you will be able to edit the page and it will behave exactly like a normal web part page. You'll see the List View Web Part on the page which you can bring up the web part properties for. Then in the Miscellaneous group, you'll see XSL Link where you can apply your already existing XSL file.

 

At least doing it this way, if you need to reverse the change you can edit the web part again and remove the XSL reference, whereas doing it through SharePoint Designer can often lead to "funnies".

View solution in original post