2 using System
.Collections
;
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;
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 ();
40 // XPathDocument input = new XPathDocument (xtr);
42 StringWriter sw
= new StringWriter ();
43 trans
.Transform (input
, null, sw
);
45 StreamWriter fw
= new StreamWriter (outfile
);
46 fw
.Write (sw
.ToString ());
49 } catch (Exception ex
) {
50 Console
.WriteLine ("\n\n\nException: " + testCase
.GetAttribute ("id") + ": " + ex
);