找不到与命名空间 http://schemas.microsoft.com/WebParts/v3/Publishing/runtime 关联的脚本或扩展对象

Posted

技术标签:

【中文标题】找不到与命名空间 http://schemas.microsoft.com/WebParts/v3/Publishing/runtime 关联的脚本或扩展对象【英文标题】:Cannot find a script or an extension object associated with namespace http://schemas.microsoft.com/WebParts/v3/Publishing/runtime 【发布时间】:2014-05-03 14:50:42 【问题描述】:

我有一个自定义 Xsl 文件可用于我的 XsltListViewWebPart,但是当我运行包含 Web 部件的页面时,我的日志中出现以下异常:

Error while executing web part: System.Xml.Xsl.XslTransformException: Cannot find a script or an extension object associated with namespace 'http://schemas.microsoft.com/WebParts/v3/Publishing/runtime'.     at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)     at <xsl:template name="OuterTemplate.GetSafeStaticUrl">(XmlQueryRuntime urn:schemas-microsoft-com:xslt-debugruntime, XPathNavigator urn:schemas-microsoft-com:xslt-debugcurrent, String UrlColumnName)     at <xsl:template match="Row">(XmlQueryRuntime urn:schemas-microsoft-com:xslt-debugruntime, XPathNavigator urn:schemas-microsoft-com:xslt-debugcurrent)     at <xsl:template match="dsQueryResponse">(XmlQueryRuntime urn:schemas-microsoft-com:xslt-debugruntime... 1fbf809c-8c95-d00a-8f55-21bd43c1d0d2
        89a1    High        ..., XPathNavigator urn:schemas-microsoft-com:xslt-debugcurrent)     at <xsl:apply-templates>(XmlQueryRuntime urn:schemas-microsoft-com:xslt-debugruntime, XPathNavigator )     at Root(XmlQueryRuntime urn:schemas-microsoft-com:xslt-debugruntime)     at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ApplyXslTransform(XPathNavigator dataNavigator, XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)     at Microsoft.SharePoint.WebPartPages.DataFormWeb...  1fbf809c-

我的 xsl 文件是:

<xsl:stylesheet version="1.0"
            exclude-result-prefixes="msxsl"
            xmlns:x="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
            xmlns:cbq="urn:schemas-microsoft-com:ContentByQueryWebPart"
            xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" 
            xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
            xmlns:ddwrt2="urn:frontpage:internal"
            xmlns:msxsl="urn:schemas-microsoft-com:xslt">

     ...

     <xsl:template name="OuterTemplate.GetSafeStaticUrl">
         <xsl:param name="UrlColumnName"/>
         <xsl:variable name="Url">
             <xsl:call-template name="OuterTemplate.FormatColumnIntoUrl">
                 <xsl:with-param name="UrlColumnName" select="$UrlColumnName"/>
             </xsl:call-template>
         </xsl:variable>

         <xsl:value-of select="cmswrt:EnsureIsAllowedProtocol($Url)"/> // Using cmswrt here
    </xsl:template>

    ...

</xsl:stylesheet>

我做错了什么?

【问题讨论】:

您是否在尝试添加 Web 部件的网站上启用了publishing features? 【参考方案1】:

使用自定义 XSLT 选项时,您必须自己维护扩展 Xml,就像调用外部程序集的内联自定义 Xslt 一样。

文档:http://msdn.microsoft.com/en-us/library/aa547368.aspx

示例:http://blog.vertica.dk/2013/03/20/using-custom-xslt-in-biztalk/

【讨论】:

以上是关于找不到与命名空间 http://schemas.microsoft.com/WebParts/v3/Publishing/runtime 关联的脚本或扩展对象的主要内容,如果未能解决你的问题,请参考以下文章

找不到与命名空间 http://schemas.microsoft.com/WebParts/v3/Publishing/runtime 关联的脚本或扩展对象

使用反应创建上下文时找不到命名空间“ctx”错误 - 打字稿

有问题,找不到类型或命名空间名称“List”

TypeScript:找不到命名空间“ng”

找不到类型或命名空间名称“异步”[重复]

找不到类型或命名空间名称“DbContext”[关闭]