Below is my code to transform XML using XSLT:
Private Sub Transform(ByVal XslUri As String, ByVal XmlString As String, ByVal OutputUri As String)
' Create the XslTransform object and load the style sheet
Dim xslt As New XslCompiledTransform()
xslt.Load(XslUri)
' Load the file to transform
Dim input As XmlReader = XmlReader.Create(New StringReader(XmlString))
' Create the writer to append
Dim fileWriter As New StreamWriter(OutputUri, True)
Dim output As XmlWriter = XmlWriter.Create( _
fileWriter, _
xslt.OutputSettings)
' Transform the file
xslt.Transform(input, output)
output.Close()
End Sub
It worked fine until I came across this piece of data in an XML input: 34 &I40 #251
It doesn't appear to be escaping the &I40 properly. What can I do differently to make sure all of my data is escaped properly? Thanks.