[英]How to embed HTML produced by C# code in XSL?
I have XSLT that creates HTML from XML. 我有从XML创建HTML的XSLT。 There are several parts of the resulting HTML that I need to create by external C# method (extension method).
我需要通过外部C#方法(扩展方法)创建HTML的结果。
Thank you very much! 非常感谢你!
Well if you want to return HTML tag soup not conforming to XML rules then you can only return a string and then use eg <xsl:value-of select="pf:yourFunction()" disable-output-escaping="yes"/>
. 好吧,如果您想返回不符合XML规则的HTML标签,那么您只能返回一个字符串,然后使用例如
<xsl:value-of select="pf:yourFunction()" disable-output-escaping="yes"/>
。 If you want to build a node-set of nodes or a result tree fragment then check the documentation , it shows the mapping between the XSLT types and the .NET framework types eg if you want your function to return an result that XSLT sees as a node-set then use the type XPathNodeIterator as the .NET return type of your extension function. 如果要构建节点的节点集或结果树片段,请查看文档 , 该文档显示了XSLT类型和.NET Framework类型之间的映射,例如,如果您希望函数返回XSLT视为节点集,然后使用XPathNodeIterator类型作为扩展功能的.NET返回类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.