Tuesday, July 2, 2013

Including a link to a javascript file in XSLT

In SharePoint 2010, I was updating a custom version of the ContentQueryMain.xsl file, needing to include javascript for the page. When I added the following code, the layout of the page changed, the ribbon stopped responding and the page would not respond when in edit mode.

<script type="text/javascript" src="/Script%20Files/myjavascript.js"></script> 

Turns out, the XSLT processor didn't care for the empty script tag. Adding the space entity &#160; fixed the problem.

<script type="text/javascript" src="/Script%20Files/myjavascript.js">&#160;</script>

 

No comments:

Post a Comment