cb34b98850981503d572f6c3c1a0959a55671e0d
[mono.git] / mcs / class / monodoc / Monodoc / generators / html / Toc2Html.cs
1 using System;
2 using System.IO;
3 using System.Xml;
4 using System.Xml.Xsl;
5 using System.Xml.XPath;
6 using System.Reflection;
7 using System.Collections.Generic;
8
9 namespace Monodoc.Generators.Html
10 {
11         public class Toc2Html : IHtmlExporter
12         {
13                 XslTransform transform;
14
15                 public Toc2Html ()
16                 {
17                         transform = new XslTransform ();
18                         var assembly = Assembly.GetAssembly (typeof (Toc2Html));
19                         var stream = assembly.GetManifestResourceStream ("toc-html.xsl");
20                         XmlReader xml_reader = new XmlTextReader (stream);
21                         transform.Load (xml_reader, null, null);
22                 }
23
24                 public string Export (Stream input, Dictionary<string, string> extraArgs)
25                 {
26                         var output = new StringWriter ();
27                         transform.Transform (new XPathDocument (input), null, output, null);
28                         return output.ToString ();
29                 }
30
31                 public string Export (string input, Dictionary<string, string> extraArgs)
32                 {
33                         var output = new StringWriter ();
34                         transform.Transform (new XPathDocument (new StringReader (input)), null, output, null);
35                         return output.ToString ();
36                 }
37
38                 public string CssCode {
39                         get {
40                                 return string.Empty;
41                         }
42                 }
43         }
44 }