关于XmlWebaprt(Xml查看器)的XslLink(XSL 链接)属性

xsllink(XSL 链接)必须为绝对路径,如果使用类似“/_layouts/PicXsl.xslt”,会被转换为“c:\_layouts\PicXsl.xslt”,页面会报错误:

2011-3-11:在另外一个服务场上又好像没有这个问题了,奇怪

“XSL”属性或“XSL Link”属性所指定的 XSL 无效,或无法访问 XSL 文件。请确保为此 Web 部件指定了有效的 XSL 样式表,或者如果链接了 XSL 文件,它能被服务器访问。请与网站管理员联系以获取帮助。了解有关使 XSL 文件可访问的详细信息

image

反编译的源代码如下:

transform2.Load(base.ReplaceTokens(transformLink), XsltSettings.Default, null);
位于private string ApplyXslt(ref string contents, string transform, string transformLink)

 

查找MSDN发现以下说明

http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.webpartpages.xmlwebpart.xsllink.aspx

The XslLink property is read/write. The URL in this property can point to any Web address; however it must be prefixed with the protocols "http://" or "https://" to work properly, for example, "http://www.domain.com" or "https://www.domain.com." There is no maximum length for this property. There is no default value. If the XSLT cannot be retrieved from the specified URL, an error is displayed in the Web Part.

posted @ 2011-02-23 16:42  ruijian  阅读(492)  评论(0编辑  收藏  举报