Thursday 23 August 2012

SharePoint 2010 Customize XSLT Changes

I wanted to perform as small task. When user clicks on my Purchase Order document library, instead of showing "Add document" link, I wanted to rename it to "Add Purchase Order" link.

There are multiple ways to achieve it
  1. Write JavaScript to get the element by anchor tag id and modify the inner text
  2. Customize the Xslt of the XSLTListViewWebPart by clicking on Customize XSLT -> Entire View in SharePoint designer. And change the AddNewText variable value for Template Type 115. 
Search for below text and change the value of "Add document" to "Whatever you like"
<xsl:with-param name="AddNewText">

But no matter whatever I modify, the changes are never reflected in browser. After trying 10-15 times and searching around. I found the solution.

Remove all the ddwrt:ghost="hide" attributes from the XSLT.

Wohoooooo... What a time waste.