Groups | Blog | Home
all groups > dotnet xml > july 2004 >

dotnet xml : Apply XSLT To XML File


Wayne Wengert
7/14/2004 2:18:25 PM
I have an xml file in which I reference an xsl template file to convert the
xml to HTML. My system also has VSNET 2003 installed and when I open the xml
file in IE6 it opens the file in VSNET instead of processing the file with
the stylesheet.

How can I get the file to apply the stylesheet?

Wayne

Dino Chiesa [Microsoft]
7/17/2004 3:15:08 PM
in code, you do it something like this:

System.Xml.XmlDocument doc= new System.Xml.XmlDocument();
doc.Load("MyXml.xml");
System.Xml.Xsl.XsltArgumentList xslArgs= null;
System.Xml.Xsl.XslTransform xsl= new System.Xml.Xsl.XslTransform();
xsl.Load("MyXsl.xsl"));
xsl.Transform(doc.CreateNavigator(), xslArgs, outputStream);

if you put that code into a console app, and specify System.Console.Out as
the output stream, you should get HTML on the console stdout.

I think loading the XML into an IE browser will also do this, automatically,
if the XSL reference is resolvable.

-D



[quoted text, click to view]

Wayne Wengert
7/17/2004 5:30:57 PM
Thanks for the reply - I'll try that.

Wayne

[quoted text, click to view]

AddThis Social Bookmark Button