// Collection of code snippets by Arne Vajhøj
// posted to eksperten.dk, usenet and other places (2002-now)
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
namespace E
{
public class Util
{
public string DocType()
{
return @"";
}
}
public class MainClass
{
public static void Main(string[] args)
{
string input =
@"
ABC
";
string transform =
@"
Demo
Data =
";
XmlDocument doc = new XmlDocument();
doc.LoadXml(input);
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(new XmlTextReader(new StringReader(transform)), new XsltSettings(true, true), null);
StringWriter sw = new StringWriter();
XmlTextWriter wrt = new XmlTextWriter(sw);
wrt.Formatting = Formatting.Indented;
XsltArgumentList xal = new XsltArgumentList();
xal.AddExtensionObject("urn:arne:cs", new Util());
xslt.Transform(doc, xal, wrt);
Console.WriteLine(sw.ToString());
}
}
}