Search code examples
c#.netxsltxpathcompact-framework

XSLT and XPath libraries for .NET Compact Framework


anybody can suggest me a library or C# code for .net compact framework 3.5 to perform XSL Transformations and/or xpath navigations?

Before you start typing please note that my needs are for .NET COMPACT FRAMEWORK, I know that the full framework has classes for this. Note also that I tried and found that the System.Xml.Linq.XDocument and related classes are not concerned to XSLT and XPath.

So, thanx in advance!!!


Solution

  • Actually I found that I can use the Interop.MSXML2.dll library in Compact Framework for XSLT transforming. Here is an example code:

    // Apply XSLT transform
    var domXml = new DOMDocument();
    domXml.loadXML(xml);
    string xsltPath = "file.xslt";
    var domXslt = new DOMDocument();
    using (var xsltReader = new StreamReader(xsltPath, Encoding.UTF8))
    {
        domXslt.loadXML(xsltReader.ReadToEnd());
    }
    string transformedXml = domXml.transformNode(domXslt.documentElement);