2

I have been struggling to edit all my custom display forms and view forms to render using external xsl files. So far I found out that normal ways cited around the internet do not work very smoothly for my view forms, but I managed to find a workaround for them (I only use xsl:include and link to a file which is in the default /_layouts/xsl/ folder).

So now I am trying to fix the display forms. I have created a custom display form for a particular content type; then I use xsl:include (or xsl:import) and link the external xsl file (which is already in the /_layouts/xsl/ folder). I also delete any custom xsl templates from within the custom display form, so that I am sure it will render my custom xsl file.

After all this, the fields render as expected in SPDesigner and in IE, but when I go and make edits to the linked xsl file (from the server) it doesn't update my changes neither in SPD, nor in IE. It updates the fields only if I go and edit the xsl include/import tag (I edit it with the same xsl link - so I don't make any actual changes) and then I save the custom display form.

I tried also with the xsl link - same result - it will show the updated xsl file only if I go to the xsl link property of the web part, click in it, and save the web part.

Do you have any ideas what I might be doing wrong?

Edit: I just noticed that the views also don't update correctly. If I update the file from the server, nothing gets updated on the view. If I go and save the view (without making any changes to it) then the update from the server shows. I can also make 1 more update on the server xsl file and it will be displayed. Further changes to the server xsl do not display and I need to open the view from SPD and 'save' it again to show the updates. Is there any caching logic for included xsl files?

1 Answer 1

2

I'll answer my own question:

I couldn't make my views and display forms work with xsl:import, so I had to use xsl:include. Xsl:include caches the included xsl and does not refresh when the included xsl file is changed - this is by design as explained in this thread. So after all I couldn't use it.

I resolved my issue by using 'xsl link' property for the web parts of views and display forms. For display forms I had to disable caching to make sure it picks changes made to the linked xsl. Once I was done with the editing I enabled caching again for performance reasons.

1
  • You can force the reloading of xsl stylesheets by going in to IIS and running recycle on the application pool for the sharepoint site. That lets you see immediately how they look and work.
    – bgmCoder
    Commented Dec 8, 2015 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.