Private Sub TransformXSLT2Html(Xsl As String, Xml As String) As String
Dim TransformerFactory As JavaObject
TransformerFactory = TransformerFactory.InitializeStatic("javax.xml.transform.TransformerFactory").RunMethod("newInstance", Null)
Dim transformer As JavaObject = TransformerFactory.RunMethod("newTransformer", Array(CreateStreamFromString(Xsl)))
Dim out As OutputStream
out.InitializeToBytesArray(1000)
Dim StreamResult As JavaObject
StreamResult.InitializeNewInstance("javax.xml.transform.stream.StreamResult", Array(out))
transformer.RunMethod("transform", Array(CreateStreamFromString(Xml), StreamResult))
Dim b() As Byte = out.ToBytesArray
Return BytesToString(b, 0, b.Length, "utf8")
End Sub
Private Sub CreateStreamFromString(s As String) As JavaObject
Dim b() As Byte = s.GetBytes("utf8")
Dim in As InputStream
in.InitializeFromBytesArray(b, 0, b.Length)
Dim stream As JavaObject
stream.InitializeNewInstance("javax.xml.transform.stream.StreamSource", Array(in))
Return stream
End Sub