TheChampp
TheChampp

Reputation: 1437

XSLT Code Inside ASPX Page

I have xslt document which I included inside xml file(the file below). 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. Is it possible ?

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

Upvotes: 1

Views: 580

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167571

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. 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.

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 e.g. <iframe with="100%" height="200" src="yourXmlFile.xml"></iframe>.

Upvotes: 2

Related Questions