|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Does system.xml have any way to transofrm data with an xswl style sheet using strings like MSXML2 doDoes system.xml have any way to transofrm data with an xswl style sheet
using strings like MSXML2 does? how to convert this to use System.XML so i do not depend on MSXML2 interop? static public string XslTransform(string style, string strdata) { MSXML2.IXMLDOMDocument pDoc = new MSXML2.DOMDocumentClass(); pDoc.async = false; pDoc.loadXML(strdata); MSXML2.IXMLDOMDocument pTemplate = new MSXML2.DOMDocumentClass(); pTemplate.async = false; pTemplate.loadXML(style); strdata = pDoc.transformNode(pTemplate); return strdata; } xswl style sheet? From the code it looks like you are doing XSL or XSLT
(pretty synonymous in .NET, although they DO mean different things technically). If so, the help file shows how to use a transform object to transform. You can transform out to a file or to a stream object to output the transformation as a string. I ahve an old sample (1.0) in the download file for the "ADO.NET and XML: ASP.NET on the Edge" book. Go to http://www.wiley.com/exras and find the book. The samples are in the last few chapters and are in VB.NET, but you should be able to work with the concepts. NOTE that 1.1 has changed this slightly, so look at the .NET Framework class library reference for differences. -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA *************************** Think Outside the Box! *************************** "Daniel" wrote: > Does system.xml have any way to transofrm data with an xswl style sheet > using strings like MSXML2 does? > > how to convert this to use System.XML so i do not depend on MSXML2 interop? > > static public string XslTransform(string style, string strdata) > { > MSXML2.IXMLDOMDocument pDoc = new MSXML2.DOMDocumentClass(); > pDoc.async = false; > pDoc.loadXML(strdata); > MSXML2.IXMLDOMDocument pTemplate = new MSXML2.DOMDocumentClass(); > pTemplate.async = false; > pTemplate.loadXML(style); > strdata = pDoc.transformNode(pTemplate); > return strdata; > } > > > |
|||||||||||||||||||||||