sharepoint2010由于在页面中加入xsl标签导致web部件无法显示

zgy_adapter 2015-09-01 11:21:22
如题,因为调整页面上web部件的样式而加入了xsl标签。导致页面显示时出现web部件无法显示。将xsl便签的内容删除后又恢复正常。该如何解决呢。
...全文
649 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
霖雨 版主 2015-09-07
  • 打赏
  • 举报
回复
你最好把原来的代码贴上来,你改了的地方贴上来,然后才看的出来是不是有问题。。 xslt报错了,只能是加错了位置或者标签
zgy_adapter 2015-09-06
  • 打赏
  • 举报
回复
引用 7 楼 legendgod 的回复:
[quote=引用 3 楼 zgy_adapter 的回复:] [quote=引用 2 楼 linyustar 的回复:] xslt是需要严格标记的,你写的不对自然就报错,要有完整的闭合标签,不符合语法的都会报错; 不知道你这提问,还有什么意思?!你也不说改什么,也没有部分代码,表示很纠结。。
代码是sharepoint designer自动生成的。[/quote]我不止一次看過SPD產生的代碼, 儲存後SharePoint自己出error說syntax錯誤的, 所以別太相信SPD 當顯示「web部件无法显示」錯誤時有沒有corelation ID? 有沒有看ULS LOG找詳細錯誤?[/quote]我看了下报错的那条数据是这样的
09/05/2015 09:56:30.30 	w3wp.exe (0x28B8)                       	0x083C	SharePoint Foundation         	Web Parts                     	89a1	High    	Error while executing web part: System.NullReferenceException: 未将对象引用设置到对象的实例。     在 System.Xml.Xsl.XslCompiledTransform.Load(MethodInfo executeMethod, Byte[] queryData, Type[] earlyBoundTypes)     在 Microsoft.Xslt.STransform.GetCompiledTransform()     在 Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.LoadXslCompiledTransform(WSSXmlUrlResolver someXmlResolver)     在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXslCompiledTransform()     在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)	3da23878-f5e9-4762-bb76-2208e54f608e
  • 打赏
  • 举报
回复
引用 3 楼 zgy_adapter 的回复:
[quote=引用 2 楼 linyustar 的回复:] xslt是需要严格标记的,你写的不对自然就报错,要有完整的闭合标签,不符合语法的都会报错; 不知道你这提问,还有什么意思?!你也不说改什么,也没有部分代码,表示很纠结。。
代码是sharepoint designer自动生成的。[/quote]我不止一次看過SPD產生的代碼, 儲存後SharePoint自己出error說syntax錯誤的, 所以別太相信SPD 當顯示「web部件无法显示」錯誤時有沒有corelation ID? 有沒有看ULS LOG找詳細錯誤?
霖雨 版主 2015-09-01
  • 打赏
  • 举报
回复
xslt是需要严格标记的,你写的不对自然就报错,要有完整的闭合标签,不符合语法的都会报错; 不知道你这提问,还有什么意思?!你也不说改什么,也没有部分代码,表示很纠结。。
zgy_adapter 2015-09-01
  • 打赏
  • 举报
回复
自己顶一下~
zgy_adapter 2015-09-01
  • 打赏
  • 举报
回复
引用 5 楼 linyustar 的回复:
你最好从始至终描述一下,在页面上添加了什么WebPart,然后,你想修改什么功能,改了什么保存报错,然后删掉又好了; 这样没头没尾的问题,实在不好说为什么就报错了,但是只要报错了,肯定是添加xslt代码错误,可能格式、标签,哪怕一个不该有的空格标点都可能;
就sharepoint的列表,功能上没有修改什么就只是调整了下列宽,删掉的<xsl></xsl>标签里的内容就又不报错了。xsl标签的内容
<xsl><xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"> 
  <xsl:include href="/_layouts/xsl/main.xsl"/> 
  <xsl:include href="/_layouts/xsl/internal.xsl"/> 
              <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
              <xsl:param name="dvt_apos">'</xsl:param>
            <xsl:template name="FieldRef_header._x5c97__x4f4d__x804c__x52a1_" ddwrt:dvt_mode="header" match="FieldRef[@Name='_x5c97__x4f4d__x804c__x52a1_']" mode="header" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
    <th nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)" style="width: 143px">
      <xsl:attribute name="class">
        <xsl:choose>
              <xsl:when test="(@Type='User' or @Type='UserMulti') and ($PresenceEnabled='1')">ms-vh</xsl:when>
              <xsl:otherwise>ms-vh2</xsl:otherwise>
         </xsl:choose>
      </xsl:attribute>
      <xsl:call-template name="dvt_headerfield._x5c97__x4f4d__x804c__x52a1_">
        <xsl:with-param name="fieldname">
          <xsl:value-of select="@Name"/>
        </xsl:with-param>
        <xsl:with-param name="fieldtitle">
          <xsl:value-of select="@DisplayName"/>
        </xsl:with-param>
        <xsl:with-param name="displayname">
          <xsl:value-of select="@DisplayName"/>
        </xsl:with-param>
        <xsl:with-param name="fieldtype">
              <xsl:choose>
                <xsl:when test="@Type='Number' or @Type='Currency'">number</xsl:when>
                <xsl:otherwise>x:string</xsl:otherwise>
              </xsl:choose>
        </xsl:with-param>
      </xsl:call-template>
    </th>
  </xsl:template></xsl:stylesheet></xsl>
霖雨 版主 2015-09-01
  • 打赏
  • 举报
回复
你最好从始至终描述一下,在页面上添加了什么WebPart,然后,你想修改什么功能,改了什么保存报错,然后删掉又好了; 这样没头没尾的问题,实在不好说为什么就报错了,但是只要报错了,肯定是添加xslt代码错误,可能格式、标签,哪怕一个不该有的空格标点都可能;
zgy_adapter 2015-09-01
  • 打赏
  • 举报
回复
<xsl><xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"> 
  <xsl:include href="/_layouts/xsl/main.xsl"/> 
  <xsl:include href="/_layouts/xsl/internal.xsl"/> 
  			<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
  			<xsl:param name="dvt_apos">'</xsl:param>
			<xsl:template name="FieldRef_header._x5c97__x4f4d__x804c__x52a1_" ddwrt:dvt_mode="header" match="FieldRef[@Name='_x5c97__x4f4d__x804c__x52a1_']" mode="header" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
    <th nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)" style="width: 143px">
      <xsl:attribute name="class">
        <xsl:choose>
          	<xsl:when test="(@Type='User' or @Type='UserMulti') and ($PresenceEnabled='1')">ms-vh</xsl:when>
          	<xsl:otherwise>ms-vh2</xsl:otherwise>
         </xsl:choose>
      </xsl:attribute>
      <xsl:call-template name="dvt_headerfield._x5c97__x4f4d__x804c__x52a1_">
        <xsl:with-param name="fieldname">
          <xsl:value-of select="@Name"/>
        </xsl:with-param>
        <xsl:with-param name="fieldtitle">
          <xsl:value-of select="@DisplayName"/>
        </xsl:with-param>
        <xsl:with-param name="displayname">
          <xsl:value-of select="@DisplayName"/>
        </xsl:with-param>
        <xsl:with-param name="fieldtype">
          	<xsl:choose>
            	<xsl:when test="@Type='Number' or @Type='Currency'">number</xsl:when>
            	<xsl:otherwise>x:string</xsl:otherwise>
          	</xsl:choose>
        </xsl:with-param>
      </xsl:call-template>
    </th>
  </xsl:template></xsl:stylesheet></xsl>
zgy_adapter 2015-09-01
  • 打赏
  • 举报
回复
引用 2 楼 linyustar 的回复:
xslt是需要严格标记的,你写的不对自然就报错,要有完整的闭合标签,不符合语法的都会报错; 不知道你这提问,还有什么意思?!你也不说改什么,也没有部分代码,表示很纠结。。
代码是sharepoint designer自动生成的。

3,242

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧