/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public string TransformXML(string xml, string xslt) { string output = string.Empty; transform.Transform(xpd.CreateNavigator(), null, sr); output = sr.ToString(); return output; } //Note that the XSL needs namespace prefixes to make .Net happy: xsl = @"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method='text'/> <xsl:template match='msg'>Found it!</xsl:template> </xsl:stylesheet>"; xml = @"<msg/>";