(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.XML / Test / System.Xml.Xsl / standalone_tests / prepare.cs
blob5310bc4626cb3be05a1b1499148c17c28c8ee413
1 using System;
2 using System.Collections;
3 using System.IO;
4 using System.Text;
5 using System.Xml;
6 using System.Xml.Xsl;
8 namespace XsltTest
10 public class XsltTest
12 public static void Main ()
14 XmlDocument whole = new XmlDocument ();
15 string xalan = @"testsuite/TESTS/Xalan_Conformance_Tests/";
16 whole.Load (xalan + "catalog.xml");
17 foreach (XmlElement testCase in whole.SelectNodes ("test-suite/test-catalog/test-case")) {
18 string stylesheetBase = null;
19 try {
20 string filePath = testCase.SelectSingleNode ("file-path").InnerText;
21 string path = xalan + filePath + "/";
22 foreach (XmlElement scenario in testCase.SelectNodes ("scenario")) {
23 XslTransform trans = new XslTransform ();
24 stylesheetBase = scenario.SelectSingleNode ("input-file[@role='principal-stylesheet']").InnerText;
25 string stylesheet = path + stylesheetBase;
26 string srcxml = path + scenario.SelectSingleNode ("input-file[@role='principal-data']").InnerText;
27 string outfile = path + scenario.SelectSingleNode ("output-file[@role='principal']").InnerText;
28 XmlTextReader stylextr = new XmlTextReader (stylesheet);
29 XmlValidatingReader stylexvr = new XmlValidatingReader (stylextr);
30 XmlDocument styledoc = new XmlDocument ();
31 styledoc.Load (stylesheet);
32 trans.Load (stylesheet);
33 // trans.Load (styledoc);
34 XmlTextReader xtr = new XmlTextReader (srcxml);
35 XmlValidatingReader xvr = new XmlValidatingReader (xtr);
36 xvr.ValidationType = ValidationType.None;
37 XmlDocument input = new XmlDocument ();
38 input.Load (xvr);
39 // input.Load (xtr);
40 // XPathDocument input = new XPathDocument (xtr);
42 StringWriter sw = new StringWriter ();
43 trans.Transform (input, null, sw);
44 sw.Close ();
45 StreamWriter fw = new StreamWriter (outfile);
46 fw.Write (sw.ToString ());
47 fw.Close ();
49 } catch (Exception ex) {
50 Console.WriteLine ("\n\n\nException: " + testCase.GetAttribute ("id") + ": " + ex);