1

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>

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

I found XML Control <asp:Xml ID="Xml1" runat="server" DocumentSource="~/PlanetCafe.xml" TransformSource="~/PlanetCafe.xslt"></asp:Xml>. This works for reading xslt from xml and transform it to aspx page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.