【问题标题】:getting return type dictionary from external C# method call从外部 C# 方法调用获取返回类型字典
【发布时间】:2018-12-24 05:32:45
【问题描述】:

我正在使用 XSLT 调用 C# 方法,该方法又调用 Oracle 数据库并在字典中返回一组键值。 我需要将此字典存储在我的 xslt 中的变量中,然后将其作为参数传递给另一个外部 C# 函数。 虽然如果我在 <msxsl:script> 部分定义 C# 函数,它会给我一个设计时错误。 关于如何做的任何想法。我需要在 xslt 中引用一个额外的命名空间吗? 任何帮助将不胜感激。

【问题讨论】:

  • 请向我们展示最小但完整的 C# 和 XSLT sn-ps 以重现该问题,以及您正在使用的 XSLT 处理器的精确信息。
  • 我最终设法解决了这个问题,方法是更改​​ C# 方法,改为以 Xml 的形式返回值。

标签: xml xslt mapping


【解决方案1】:
I managed to work out the problem by changing the data type of my C# method from a Dictionary to a Xml instead.
According to this link (**https://docs.microsoft.com/en-us/dotnet/standard/data/xml/xslt-stylesheet-scripting-using-msxsl-script**)
the arguments and Return types for any of the scripts being called from XSLT should be one of these:

System.String   
System.Boolean  
System.Double   
System.Xml.XPath.XPathNavigator     
System.Xml.XPath.XPathNodeIterator  

Hope this helps!

【讨论】:

    猜你喜欢
    • 2011-12-24
    • 2013-04-12
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 1970-01-01
    相关资源
    最近更新 更多