sharepoint xslt 中使用 msxsl:script报错
xslt格式如下:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:srwrt="http://schemas.microsoft.com/WebParts/v3/searchresults/runtime"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:ddwrt2="urn:frontpage:internal"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts">
<msxsl:script language="C#" implements-prefix="user">
<![CDATA[
public string strReplace(string str1,string str2, string str3)
{
return str1.Replace(str2, str3);
}
]]>
</msxsl:script>
错误:
0x80004005 安全设置不允许在此样式表内执行脚本代码
------解决方案--------------------
使用JavaScript在相应的页面开启改功能:
doc.setProperty("AllowXsltScript", true);
http://msdn.microsoft.com/en-us/library/windows/desktop/ms763800(v=vs.85).aspx