Solved

Advice needed:  create html page dynamically

Posted on 2003-11-25
6
420 Views
Last Modified: 2010-04-16
In a C# DLL, I am looking for ways to create an HTML page dynamically at runtime.  The effect would be similar to taking a Word Document and replacing bookmarks with content from a database at runtime.  The HTML page has several elements:

1)  Static text that never changes.
2)  Dynamic text (often embedded at various points inside the static text)
3)  Style and formatting that needs to be applied to the entire document (Cascading Style Sheets) as well as the dynamic text.


The way I am doing it now is functional, but is very difficult to maintain because it is in one big blob.  I need an easier way to seperate content from formatting.

public void CreateGift()
                  {
                        swStreamWriter = new StreamWriter(fsFileStream); // create a stream writer
                        swStreamWriter.BaseStream.Seek(0, SeekOrigin.End); // set the file pointer to the end of file
                        swStreamWriter.WriteLine("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
                        swStreamWriter.WriteLine("<HTML>");
                        swStreamWriter.WriteLine("<HEAD>");
                        swStreamWriter.WriteLine("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=windows-1252\">");
                        swStreamWriter.WriteLine("<TITLE></TITLE>");
                        swStreamWriter.WriteLine("<META NAME=\"GENERATOR\" CONTENT=\"OpenOffice.org 1.1.0  (Win32)\">");
                        swStreamWriter.WriteLine("<META NAME=\"CREATED\" CONTENT=\"20031124;12125657\">");
                        swStreamWriter.WriteLine("<META NAME=\"CHANGED\" CONTENT=\"20031124;12134332\">");
                        swStreamWriter.WriteLine("<STYLE>");
                        swStreamWriter.WriteLine("<!--");
                        swStreamWriter.WriteLine("@page { size: 8.5in 11in; margin-right: 0.35in; margin-top: 0.4in; margin-bottom: 0.7in }");
                        swStreamWriter.WriteLine("P { margin-bottom: 0.08in; direction: ltr; color: #000000; widows: 2; orphans: 2 }");
                        swStreamWriter.WriteLine("P.western { font-family: \"Times New Roman\", serif; font-size: 12pt; so-language: en-US }");
                        swStreamWriter.WriteLine("P.cjk { font-family: \"Times New Roman\", serif; font-size: 12pt }");
                        swStreamWriter.WriteLine("P.ctl { font-family: \"Times New Roman\", serif; font-size: 12pt; so-language: ar-SA }");
                        swStreamWriter.WriteLine("P.text-body-indent-western { margin-left: 0.2in; font-family: \"Times New Roman\", serif; font-size: 12pt; so-language: en-US }");
                        swStreamWriter.WriteLine("P.text-body-indent-cjk { margin-left: 0.2in; font-family: \"Times New Roman\", serif; font-size: 12pt }");
                        swStreamWriter.WriteLine("P.text-body-indent-ctl { margin-left: 0.2in; font-family: \"Times New Roman\", serif; font-size: 12pt; so-language: ar-SA }");
                        swStreamWriter.WriteLine("A:link { color: #0000ff }");
                        swStreamWriter.WriteLine("-->");
                        swStreamWriter.WriteLine("</STYLE>");
                        swStreamWriter.WriteLine("</HEAD>");
                        swStreamWriter.WriteLine("<BODY LANG=\"en-US\" TEXT=\"#000000\" LINK=\"#0000ff\" DIR=\"LTR\">");
                        swStreamWriter.WriteLine("<DIV TYPE=HEADER>");
                        swStreamWriter.WriteLine("<P ALIGN=RIGHT STYLE=\"margin-bottom: 0.3in\"><IMG SRC=\"bf.gif\" NAME=\"Graphic2\" ALIGN=BOTTOM WIDTH=190 HEIGHT=82 BORDER=0></P>");
                        swStreamWriter.WriteLine("</DIV>");
                        swStreamWriter.WriteLine("<P CLASS=\"text-body-indent-western\"><BR><BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=5 STYLE=\"font-size: 20pt\"><B>Buyers");
                        swStreamWriter.WriteLine("Fund Gift Letter</B></FONT></FONT></P>");
                        swStreamWriter.WriteLine("<DL>");
                        swStreamWriter.WriteLine("<DL>");
                        swStreamWriter.WriteLine("<DD>");
                        swStreamWriter.WriteLine("<TABLE WIDTH=601 BORDER=1 BORDERCOLOR=\"#000000\" CELLPADDING=0 CELLSPACING=0 FRAME=BELOW RULES=ROWS>");
                        swStreamWriter.WriteLine("<COL WIDTH=84>");
                        swStreamWriter.WriteLine("<COL WIDTH=217>");
                        swStreamWriter.WriteLine("<COL WIDTH=62>");
                        swStreamWriter.WriteLine("<COL WIDTH=237>");
                        swStreamWriter.WriteLine("<TR VALIGN=TOP>");
                        swStreamWriter.WriteLine("<TD WIDTH=84>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">To:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=217>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><A NAME=\"lo_fff12_1\"></A> ");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=62>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">From:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=237>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT FACE=\"Garamond, serif\"><FONT SIZE=3>Buyers");
                        swStreamWriter.WriteLine("Fund</FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("</TR>");
                        swStreamWriter.WriteLine("<TR VALIGN=TOP>");
                        swStreamWriter.WriteLine("<TD WIDTH=84>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Fax:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=217>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><A NAME=\"LenderFax_fff12_1\"></A> ");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=62>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Fax</FONT></FONT></B></FONT></FONT><FONT SIZE=3><FONT FACE=\"Garamond, serif\">:</FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=237>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT FACE=\"Garamond, serif\"><FONT SIZE=3>888-523-8983;");
                        swStreamWriter.WriteLine("801-734-1364</FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("</TR>");
                        swStreamWriter.WriteLine("<TR VALIGN=TOP>");
                        swStreamWriter.WriteLine("<TD WIDTH=84>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Company:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=217>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><A NAME=\"Lender_fff12_1\"></A> ");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=62>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Phone:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=237>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-left: 0.12in; text-indent: -0.12in; margin-top: 0.17in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=3>888-228-2279</FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("</TR>");
                        swStreamWriter.WriteLine("<TR VALIGN=TOP>");
                        swStreamWriter.WriteLine("<TD WIDTH=84>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Sent:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=217>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><SDFIELD TYPE=DATETIME SDNUM=\"1033;1033;M/D/YYYY H:MM:SS AM/PM\">11/24/2003 12:13:44 pm</SDFIELD></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=62>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT FACE=\"Garamond, serif\"><FONT SIZE=3><B>Pages:</B></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD WIDTH=237>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT FACE=\"Garamond, serif\"><FONT SIZE=3>3,");
                        swStreamWriter.WriteLine("including cover</FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("</TR>");
                        swStreamWriter.WriteLine("<TR VALIGN=TOP>");
                        swStreamWriter.WriteLine("<TD WIDTH=84>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><FONT SIZE=2><FONT FACE=\"Arial, sans-serif\"><FONT SIZE=2 STYLE=\"font-size: 9pt\"><B><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Subject:</FONT></FONT></B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("<TD COLSPAN=3 WIDTH=517>");
                        swStreamWriter.WriteLine("<P STYLE=\"margin-top: 0.17in\"><A NAME=\"Buyer_fff12_1\"></A><A NAME=\"EntryId_fff12_1\"></A>");
                        swStreamWriter.WriteLine("<FONT SIZE=2><FONT SIZE=3><FONT FACE=\"Garamond, serif\">Gift");
                        swStreamWriter.WriteLine("Letter for<B>  , #</B></FONT></FONT></FONT></P>");
                        swStreamWriter.WriteLine("</TD>");
                        swStreamWriter.WriteLine("</TR>");
                        swStreamWriter.WriteLine("</TABLE>");
                        swStreamWriter.WriteLine("</DL>");
                        swStreamWriter.WriteLine("</DL>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=4><B>Message:</B></FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\"><A NAME=\"lo_fff11_2\"></A>");
                        swStreamWriter.WriteLine("<FONT SIZE=2 STYLE=\"font-size: 11pt\"><FONT FACE=\"Garamond, serif\">Dear");
                        swStreamWriter.WriteLine("<B> </B>,</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">Thank");
                        swStreamWriter.WriteLine("you for the new grant application.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">We");
                        swStreamWriter.WriteLine("appreciate your business.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">We");
                        swStreamWriter.WriteLine("will contact the title company today to send out closing");
                        swStreamWriter.WriteLine("instructions.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">Sincerely,</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">Buyers");
                        swStreamWriter.WriteLine("Fund Processing Department</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\"><B>Gift");
                        swStreamWriter.WriteLine("Letter Instructions:</B></FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<BR>");
                        swStreamWriter.WriteLine("</P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">1.");
                        swStreamWriter.WriteLine("To validate the Gift Letter, have the home buyer sign it. This must");
                        swStreamWriter.WriteLine("be done before using it as proof of down payment (i.e. with FHA).</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\">");
                        swStreamWriter.WriteLine("<FONT FACE=\"Garamond, serif\"><FONT SIZE=2 STYLE=\"font-size: 11pt\">2.");
                        swStreamWriter.WriteLine("You do not need to send the gift letter back to us. This letter is to");
                        swStreamWriter.WriteLine("be presented to the homebuyer, and copies of it are to be used as you");
                        swStreamWriter.WriteLine("see fit.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\"><A NAME=\"GrantAmount_fff11_1\"></A>");
                        swStreamWriter.WriteLine("<FONT SIZE=2 STYLE=\"font-size: 11pt\"><FONT FACE=\"Garamond, serif\">3.");
                        swStreamWriter.WriteLine("The grant your buyer has been approved for is <B> </B>.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("<P CLASS=\"western\" ALIGN=JUSTIFY STYLE=\"margin-left: 0.75in; margin-right: 0.75in; margin-bottom: 0in\"><A NAME=\"GrantAmount_fff11_2\"></A>");
                        swStreamWriter.WriteLine("<FONT SIZE=2 STYLE=\"font-size: 11pt\"><FONT FACE=\"Garamond, serif\">4.");
                        swStreamWriter.WriteLine("The seller service fee paid by the seller to Buyers Fund is the grant");
                        swStreamWriter.WriteLine("(<B> </B>) <I>and</I> the net fee.</FONT></FONT></P>");
                        swStreamWriter.WriteLine("</DIV>");
                        swStreamWriter.WriteLine("</BODY>");
                        swStreamWriter.WriteLine("</HTML>");

                        swStreamWriter.Flush(); // update underlying file
                        swStreamWriter.Close();



                  }
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Assisted Solution

by:ptmcomp
ptmcomp earned 50 total points
ID: 9819962
There are several solutions:
- a local webserver and asp.net.
- Template as file with special placeholders (e.g. $TEXT1$) that you replace with string.Replace or Regular Expressions
- Template with asp like tags that you use to create a WebControls and render them
0
 
LVL 18

Assisted Solution

by:testn
testn earned 50 total points
ID: 9824431
Try this tool. You can separate the template from the code easily.
http://nvelocity.sourceforge.net/
0
 
LVL 18

Expert Comment

by:testn
ID: 9824462
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Assisted Solution

by:Aania
Aania earned 200 total points
ID: 9827541
Depending on how you're accessing this data, one of the easiest ways is probably to do something similar to what ptmcomp already said, and store the page somewhere (in a database or a file) with some variables that you can easily search for and replace.
To give a more specific example on how this might be done, you could do the following:

SQL Table: TBLTemplates

templateID    HTML
-------------   --------
1                  <HTML><HEAD></HEAD><BODY>Hello $$NAME$$!</BODY></HTML>

Then in your C#, you would retrieve the HTML into a string:

mySQLCommand = new System.Data.SqlClient.SqlCommand("SELECT HTML FROM TBLTemplates WHERE templateID = 1", myConnection);
myConnection.Open();
string template = mySQLCommand.ExecuteScalar().ToString();
myConnection.Close();

// And then replace t he place holders with your values

string name = "Vanessa"; //Retrieve the dynamic information
template = template.Replace("$$NAME$$", name); //Insert it into the template

Response.Write(template);

And you will get
<HTML><HEAD></HEAD><BODY>Hello Vanessa!</BODY></HTML>

I hope that helps,
Thanks,
Vanessa
0
 
LVL 1

Accepted Solution

by:
AJMartin earned 200 total points
ID: 9835972
Another tip is to use CSS Stylesheets to reduce the volume of styling information you're sending and the number of WriteLine-s in your code.

Another tip is to use XML transformations which are in C# to transform a source XML document into HTML. Have a look at this page:
ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconxslttransformationswithxsltransformclass.htm
It's in the MS .NET Framework SDK.

Here's an example from the documentation:
The following code example loads an XSL style sheet, reads a file called mydata.xml into an XPathDocument, and performs a transformation on the data on a fictitious file called myStyleSheet.xsl, sending the formatted output to the console.

using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;

public class Sample
{
    private const String filename = "mydata.xml";
    private const String stylesheet = "myStyleSheet.xsl";

    public static void Main()
    {
    XslTransform xslt = new XslTransform();
    xslt.Load(stylesheet);
    XPathDocument xpathdocument = new
    XPathDocument(filename);
    XmlTextWriter writer = new XmlTextWriter(Console.Out);
    writer.Formatting=Formatting.Indented;

    xslt.Transform(xpathdocument, null, writer, null);    
    }
}

0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 9906695
Thank you for the suggestions.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question