简体   繁体   English

ASPX页面内的XSLT代码

[英]XSLT Code Inside ASPX Page

I have xslt document which I included inside xml file(the file below). 我有包含在xml文件(以下文件)中的xslt文档。 I have aspx page and I want to include this xml file inside this aspx page and when I run aspx page the xslt code in xml to run too. 我有aspx页面,我想将此XML文件包含在此aspx页面中,当我运行aspx页面时, xmlxslt代码也要运行。 Is it possible ? 可能吗 ?

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="simpletransform.xslt"?>
<JavacoTea>
   Try our new Herbal Tea!
</JavacoTea>

With ASP.NET WebForms there used to be a control to perform XSLT within a page, see http://msdn.microsoft.com/en-us/library/35b30hy4%28v=vs.100%29.aspx . 使用ASP.NET WebForms之前,曾经有一个控件可以在页面内执行XSLT,请参见http://msdn.microsoft.com/zh-cn/library/35b30hy4%28v=vs.100%29.aspx Note however that that control uses System.Xml.Xsl.XslTransform to perform the XSLT transformation, an implementation of XSLT 1.0 done by Microsoft in the .NET versions 1.x while later .NET versions have System.Xml.Xsl.XslCompiledTransform . 但是请注意,该控件使用System.Xml.Xsl.XslTransform执行XSLT转换,这是Microsoft在.NET版本1.x中实现的XSLT 1.0实现,而更高版本的.NET版本具有System.Xml.Xsl.XslCompiledTransform

And if you want the browser to perform the XSLT transformation (as your posted code does) then I would suggest to simply include an iframe element in your code eg <iframe with="100%" height="200" src="yourXmlFile.xml"></iframe> . 而且,如果您希望浏览器执行XSLT转换(就像您发布的代码一样),那么我建议您在代码中简单地包含一个iframe元素,例如<iframe with="100%" height="200" src="yourXmlFile.xml"></iframe>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM