transforming xml without a xslt file
-
how can i transform an xml using xslt without loading the xslt from a file? I have two strings containing the source of the xml and xslt I can load an xmldocument object using the InnerText property, but then i can't find a way to transform it since all the methods available for loading an xslt document and transforming the xml document involve an xslt file
-
how can i transform an xml using xslt without loading the xslt from a file? I have two strings containing the source of the xml and xslt I can load an xmldocument object using the InnerText property, but then i can't find a way to transform it since all the methods available for loading an xslt document and transforming the xml document involve an xslt file
If you are using .Net Framework try following:
// Load xml document
XmlDocument doc=new XmlDocument();
doc.LoadXml(xmlString);// Load transformation
XslTransform xslt=new XslTransform();
TextReader txt=new StringReader(xsltString);
XmlReader reader=new XmlTextReader(txt);
xslt.Load(reader,null,null);// Do transformation
xslt.Transform(...);Tomáš Petříček
www.eeeksoft.net | Photos | Fractal Snow -
how can i transform an xml using xslt without loading the xslt from a file? I have two strings containing the source of the xml and xslt I can load an xmldocument object using the InnerText property, but then i can't find a way to transform it since all the methods available for loading an xslt document and transforming the xml document involve an xslt file
Look at the loadXML() method. It takes a string of XML and loads it into the MSXML4::IXMLDOMDocument2 object.