The original Mvp.Xml project, developed by Microsoft MVP's in XML technologies and XML Web Services worldwide. It is aimed at supplementing .NET XML processing. All the project's classes contain extensive tests to ensure its quality, as well as the peer review among this highly focused group of XML lovers.
Mvp.Xml project currently provides .NET implementations of EXSLT, XML Base, XInclude, XPointer as well as a unique set of utility classes and tools making XML programming in .NET platform easier, more productive and effective.
Example usage of EXSLT:
var xslt = new MvpXslTransform();
xslt.Load("foo.xsl");
// Optionally enforce the output to be XHTML
xslt.EnforceXHTMLOutput = true;
xslt.Transform(new XmlInput("foo.xml"), new XmlOutput("result.html"));
Usage in XPath-only context:
XPathExpression expr = nav.Compile("set:distinct(//author)");
expr.SetContext(new ExsltContext(doc.NameTable));
XPathNodeIterator authors = nav.Select(expr);
while (authors.MoveNext())
Console.WriteLine(authors.Current.Value);
Example usage of XInclude:
var reader = new XIncludingReader(XmlReader.Create(uri));
var document = XDocument.Load(reader);
Some other helper classes include:
public XPathNodeIterator GetExpensiveBooks(IXPathNavigable doc, int minPrice)
{
string expr = "//mvp:titles[mvp:price > $price]";
// XPathCache optimally caches the compiled XPath expression and parameterizes it
return XPathCache.Select(expr, doc.CreateNavigator(), mgr, new XPathVariable("price", minPrice));
}
var xslt = new XslTransform();
xslt.Load("print_root.xsl");
var doc = new XPathDocument("library.xml");
var books = doc.CreateNavigator().Select("/library/book");
while (books.MoveNext())
{
// Transform subtree for current node
xslt.Transform(new SubtreeeXPathNavigator(books.Current), null, Console.Out, null);
}