sridhar19091986 / wiresharkplugin

Automatically exported from code.google.com/p/wiresharkplugin
0 stars 0 forks source link

XslCompiledTransform transform = new XslCompiledTransform(); #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
public static string Transform(string xml, string xslt)
{
    string str2;
    MemoryStream stream = new MemoryStream();
    try
    {
        XmlDocument document = new XmlDocument();
        XmlDocument stylesheet = new XmlDocument();
        document.LoadXml(xml);
        stylesheet.LoadXml(xslt);
        XslCompiledTransform transform = new XslCompiledTransform();
        transform.Load(stylesheet, null, null);
        transform.Transform((IXPathNavigable) document, null, (Stream) stream);
        stream.Flush();
        string str = Encoding.ASCII.GetString(stream.GetBuffer()).Replace("\0", string.Empty).Replace("o;?", string.Empty).Replace("\n\r", string.Empty);
        if (str.Substring(0, 3) == "???")
        {
            str = str.Substring(3);
        }
        str2 = str;
    }
    catch
    {
        throw;
    }
    finally
    {
        stream.Close();
    }
    return str2;
}

Original issue reported on code.google.com by cn.wei.hp@gmail.com on 8 Dec 2010 at 7:59