0

我收到了一个过去没有遇到过的错误(搜索后找不到解决方案)。

错误消息:用户代码未处理 XslTransformException:找不到与命名空间'uri:PhysKare.Framework.Authentication.IUserAuthenticate'关联的脚本或扩展对象。

错误详情:

   at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
   at <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
   at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
   at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
   at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
   at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
   at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
   at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results)

任何想法如何解决这个问题?

4

1 回答 1

1

您的 XSLT 在命名空间中使用自定义函数uri:PhysKare.Framework.Authentication.IUserAuthenticate,并且您没有将实现这些函数的对象传递给 XSLT 处理器 - 即您应该执行以下操作:

  XsltArgumentList args = new XsltArgumentList();
  args.AddExtensionObject("uri:PhysKare.Framework.Authentication.IUserAuthenticate", new PhysKare());
  compiledXslt.Transfor(source, args, dest)

其中PhysKare是实现 XSLT 中使用的自定义函数的类。

于 2012-09-24T19:36:11.563 回答