How to call c# function in xsl

本文关键字:in xsl function to call How | 更新日期: 2023-09-27 17:58:56

im试图调用xsl中的c函数。我必须将一些值映射到xml中。有三个主要组成部分

-xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" 
xmlns:ns0="http://iti/serv/dataloader"
xmlns:HelpersNS0="http://ri/clus/mapperhelpers/v1.0/I/F/C/CustomComponents ">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/*[local-name()='InvokeDataLoader']">
<ns0:scriptToExecute>
<xsl:value-of select="HelpersNS0:GetDataLoaderPath()"/>
</ns0:scriptToExecute>
</xsl:template>
</xsl:stylesheet>

-xml,我在那里得到c#汇编

<?xml version="1.0" encoding="UTF-8" ?>
<ExtensionObjects>
<ExtensionObject
  Namespace="http://ri/clus/mapperhelpers/v1.0/I/F/C/CustomComponents"
  AssemblyName="G.T.I_Fatt.CustomComponents, Version=1.0.0.0,Culture=neutral, PublicKeyToken=6ecedb456a4a8c16"
  ClassName="G.T.I_Fatt.CustomComponents.MapperHelpers"  />
</ExtensionObjects>

-xml转换

<?xml version="1.0" encoding="UTF-8" ?>
<InvokeDataLoader xmlns="http://iti/serv/dataloader">
<scriptToExecute/>
<inputFile/>
</InvokeDataLoader>

但当我尝试转换时,我得到了这个错误:"名称空间不包含任何函数"

How to call c# function in xsl

我注意到XSLT中有xmlns:HelpersNS0="http://ri/clus/mapperhelpers/v1.0/I/F/C/CustomComponents ts">,而另一个文件中则有Namespace="http://ri/clus/mapperhelpers/v1.0/I/F/C/CustomComponents"(没有ts)。因此名称空间不匹配。