我正在升级asp.net v3.5网络应用程序.到v4,我在XmlDataSource对象上使用的XSLT转换遇到了一些问题.
XSLT文件的一部分:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ExtensionObject="ds:ExtensionObject"> 
  <xsl:output method="xml" indent="yes" encoding="utf-8"/> 
  <xsl:template match="/Menus"> 
    <MenuItems> 
      <xsl:call-template name="MenuListing" /> 
    </MenuItems> 
  </xsl:template> 
  <xsl:template name="MenuListing"> 
    <xsl:apply-templates select="Menu" /> 
  </xsl:template> 
  <xsl:template match="Menu"> 
      <MenuItem> 
        <xsl:attribute name="Text"> 
          <xsl:value-of select="ExtensionObject:HtmlEncode(MenuTitle)"/> 
        </xsl:attribute> 
        <xsl:attribute name="ToolTip"> 
          <xsl:value-of select="MenuTitle"/> 
        </xsl:attribute> 
      </MenuItem> 
  </xsl:template> 
</xsl:stylesheet> 
这是初始化:
xmlDataSource.TransformArgumentList.AddExtensionObject("ds:ExtensionObject", new ExtensionObject()); 
xmlDataSource.Data = Cache.FetchPageMenu(); 
ExtensionObject:
public class ExtensionObject {
    public static string HtmlEncode(string input) {
        return "test";
    } 
}
之前我问了一个类似的问题:.net 4 xslt转换扩展功能坏了.对于模糊的调用,答案是对的,但即使使用另一个正确的对象,它也无法正常工作.我没有收到任何错误,只是没有显示数据.
我也试过这个;
static void test() {
    // Create the XslCompiledTransform and load the …