7

I have a custom Xsl file to use with my XsltListViewWebPart, but when i run the page with the web part inside, i get the following exception in my log:

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-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, String UrlColumnName)     at <xsl:template match="Row">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)     at <xsl:template match="dsQueryResponse">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime... 1fbf809c-8c95-d00a-8f55-21bd43c1d0d2
        89a1    High        ..., XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)     at <xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator )     at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)     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-

My xsl file is:

<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>

What i did wrong?

mnatan.brito
  • 883
  • 5
  • 18
  • 32
  • Have you enabled [publishing features](https://support.office.com/en-us/article/Enable-publishing-features-479677a6-8b33-4ac7-907d-071c1c7e4518?ui=en-US&rs=en-US&ad=US) on the site you're trying to add the web part? – Kimzter Feb 24 '17 at 13:22

1 Answers1

0

When using the Custom XSLT option, you have to maintain the Extension Xml yourself, just as you would for inline custom Xslt that calls external Assemblies.

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

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

Prachi Mishra
  • 98
  • 1
  • 10