using System.Collections; using System.ComponentModel; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; namespace AutoAttendant { /// /// Summary description for PhoneDirectoryControl. /// public class XSLTransformerControl : Control { /// /// The source file name for the XML directory. /// string _xmlSrc; public string XMLSrc { get{return _xmlSrc;} set{_xmlSrc = value;} } /// /// The source file name for the XSLT stylesheet template. /// string _styleSheetSrc; public string StyleSheetSrc { get{return _styleSheetSrc;} set{_styleSheetSrc = value;} } /// /// Overrides the function that renders this controls output. /// /// override protected void Render(HtmlTextWriter htmlWriter) { XPathDocument myXPathDocument = new XPathDocument (XMLSrc); XslTransform myXslTransform = new XslTransform(); XmlTextWriter xmlwriter = new XmlTextWriter(htmlWriter); myXslTransform.Load(StyleSheetSrc); myXslTransform.Transform(myXPathDocument, null, xmlwriter); } } }