Re: Help with XslCompiledTransform

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have <xsl:output method="xml" version="1.0"
omit-xml-declaration="no"/> in the style***.

Here's my code (hand-entered since this code is on a closed network...)

Function TransformXML(ByRef inXDoc As XmlDocument, ByVal inXslFile as
String) As String
Dim xXSL As New Xsl.XslCompiledTransform
Dim text as String
Try
Dim xwSet as XmlWriterSettings = New XmlWriterSettings
xwSet.ConformanceLevel = ConformanceLevel.Auto
Dim xr As NodeReader = New NodeReader(inXDoc.DocumentElement)
Dim sw As New System.IO.StringWriter
Dim xw As XmlWriter = XmlWriter.Create(sw, xwSet)
xXSL.Transform(xw, xw)
text = sw.ToString()
Catch ex as Exception
...
End Try
Return text
End Function

.


Quantcast