I found myselft, thanks any way.
public string TransformXml(string aXml, string aXsl)
{
string Result = "";
XmlDocument xml = new XmlDocument();
XmlDocument xsl = new XmlDocument();
xml.LoadXml(aXml);
xsl.LoadXml(aXsl);
//creating xslt
XslTransform xslt = new XslTransform();
xslt.Load(xsl, null,null) ;
//creating stringwriter
StringWriter writer = new System.IO.StringWriter();
//Transform the xml.
xslt.Transform(xml, null, writer, null);
//return string
Result = writer.ToString();
writer.Close();
return Result;
}
[quoted text, click to view] "Owen" <anibal@prensa-latina.cu> wrote in message
news:OZlSgrMREHA.1620@TK2MSFTNGP12.phx.gbl...
> Hello:
>
> I have some xml and xsl in string, "not in file". I want to transform the
> xml with xsl and the result I want in string (but in xml format). I read
> this sample :
>
> public class Sample
> {
> private const String filename = "mydata.xml";
> private const String stylesheet = "myStyleSheet.xsl";
>
> public static void Main()
> {
> XslTransform xslt = new XslTransform();
> xslt.Load(stylesheet);
> XPathDocument xpathdocument = new
> XPathDocument(filename);
> XmlTextWriter writer = new XmlTextWriter(Console.Out);
> writer.Formatting=Formatting.Indented;
>
> xslt.Transform(xpathdocument, null, writer, null);
> }
>
> And read the class help, but I can found my soluction (maybe I don't so
> wise).
> Please Help me.
>
> Best regards.
> Owen.
>
>