SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-185284%22%20slang%3D%22en-US%22%3EUse%20custom%20XSL%20for%20the%20default%20view%20of%20a%20list%20(Allitems.aspx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-185284%22%20slang%3D%22en-US%22%3E%3CP%3EI%20was%20able%20to%20successfully%20add%20a%20custom%20xsl%20to%20the%20webpart%20and%20render%20it%20the%20way%20I%20wanted.%20(I%20borrowed%20the%20example%20from%20here%3A%20%3CA%20href%3D%22http%3A%2F%2Fmundrisoft.com%2Ftech-bytes%2Fhow-to-customize-list-view-web-part-using-custom-xslt-in-sharepoint-2013%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fmundrisoft.com%2Ftech-bytes%2Fhow-to-customize-list-view-web-part-using-custom-xslt-in-sharepoint-2013%2F%3C%2FA%3E)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile%20it%20is%20easier%20me%20to%20input%20the%20link%20to%20a%20web%20part%20by%20specifying%20the%20URL%20to%20the%20XSL%20Link%20field%20in%20the%20web%20part%20properties%20panel%2C%20it%20doesn't%20seem%20to%20be%20straight%20forward%20for%20a%20list%20page.%3C%2FP%3E%3CP%3EMy%20goal%20is%20to%20to%20apply%20the%20same%20XSL%20file%20to%20the%20list%20view%20even%20when%20user%20clicks%20the%20title%20of%20the%20web%20part%20and%20goes%20to%20the%20actual%20list%20view%20(Allitems.aspx).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20opened%20up%20Allitems.aspx%20in%20SPD%2C%20and%20found%20the%20following%20tag%20-%3C%2FP%3E%3CP%3E%3CXSLLINK%20default%3D%22%26quot%3BTRUE%26quot%3B%22%3Emain.xsl%3C%2FXSLLINK%3E%3C%2FP%3E%3CP%3ECould%20I%20%2F%20Should%20I%20simply%20change%20he%20main.xsl%20to%20my%20custom%20file%20to%20meet%20the%20goal%3F%20Something%20like%20-%3C%2FP%3E%3CP%3E%3CXSLLINK%20default%3D%22%26quot%3BTRUE%26quot%3B%22%3E%2FmySharePoint%2FcustomeXSLT%2FmyXSLT.xsl%3C%2FXSLLINK%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20would%20like%20to%20get%20some%20confirmation%20before%20I%20actually%20test%20it%20and%20break%20things%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-185284%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2013%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-185422%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20custom%20XSL%20for%20the%20default%20view%20of%20a%20list%20(Allitems.aspx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-185422%22%20slang%3D%22en-US%22%3E%3CP%3EWorks%20great!%20I%20almost%20forgot%20that%20the%20list%20on%20the%20actual%20list%20view%20page%20is%20also%20a%20web%20part.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-185361%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20custom%20XSL%20for%20the%20default%20view%20of%20a%20list%20(Allitems.aspx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-185361%22%20slang%3D%22en-US%22%3E%3CP%3EI%20personally%20wouldn't%20touch%20SharePoint%20Designer%20for%20this%20when%20it%20can%20mostly%20be%20achieved%20through%20the%20SharePoint%20GUI.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20navigate%20to%20your%20list%20view%20page%2C%20you%20will%20be%20able%20to%20edit%20the%20page%20and%20it%20will%20behave%20exactly%20like%20a%20normal%20web%20part%20page.%20You'll%20see%20the%20List%20View%20Web%20Part%20on%20the%20page%20which%20you%20can%20bring%20up%20the%20web%20part%20properties%20for.%20Then%20in%20the%20Miscellaneous%20group%2C%20you'll%20see%20XSL%20Link%20where%20you%20can%20apply%20your%20already%20existing%20XSL%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20least%20doing%20it%20this%20way%2C%20if%20you%20need%20to%20reverse%20the%20change%20you%20can%20edit%20the%20web%20part%20again%20and%20remove%20the%20XSL%20reference%2C%20whereas%20doing%20it%20through%20SharePoint%20Designer%20can%20often%20lead%20to%20%22funnies%22.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1259870%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20custom%20XSL%20for%20the%20default%20view%20of%20a%20list%20(Allitems.aspx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1259870%22%20slang%3D%22en-US%22%3EVery%20helpful.%20Thanks.%3CBR%20%2F%3E%26amp%3Blt%3Bscript%26amp%3Bgt%3B%3CBR%20%2F%3Evar%20a%20%3D%20document.createElement('a')%3B%3CBR%20%2F%3Evar%20linkText%20%3D%20document.createTextNode(%22%3CA%20href%3D%22http%3A%2F%2Fwww.as.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ewww.as.com%3C%2FA%3E%22)%3B%3CBR%20%2F%3Ea.appendChild(linkText)%3B%3CBR%20%2F%3Ea.title%20%3D%20%22%3CA%20href%3D%22http%3A%2F%2Fwww.as.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ewww.as.com%3C%2FA%3E%22%3B%3CBR%20%2F%3Ea.href%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Fwww.as.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.as.com%2F%3C%2FA%3E%22%3B%3CBR%20%2F%3Edocument.body.appendChild(a)%3B%3CBR%20%2F%3E%26amp%3Blt%3B%2Fscript%26amp%3Bgt%3B%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1886676%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20custom%20XSL%20for%20the%20default%20view%20of%20a%20list%20(Allitems.aspx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1886676%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F130028%22%20target%3D%22_blank%22%3E%40Yihuan%20Liu%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Econect%20to%20me%20man%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fmaps.google.com%2Furl%3Fq%3Dhttps%3A%2F%2Falamin-alemirates.com%22%20target%3D%22_blank%22%3ECompany%20Cleaning%20alamin-alemirates%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Falamin-alemirates.com%2F%25d8%25b4%25d8%25b1%25d9%2583%25d8%25a9-%25d8%25aa%25d9%2586%25d8%25b8%25d9%258a%25d9%2581-%25d9%2585%25d9%2586%25d8%25a7%25d8%25b2%25d9%2584-%25d8%25af%25d8%25a8%25d9%258a%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%D8%B4%D8%B1%D9%83%D8%A9%20%D8%AA%D9%86%D8%B8%D9%8A%D9%81%20%D9%85%D9%86%D8%A7%D8%B2%D9%84%20%D8%AF%D8%A8%D9%8A%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional 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 (Occasional 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.