Spiegando meglio,
Public Shared Function TransformXMLToHTML(ByVal inputXml As String, ByVal xsltString As String) As String
' Dim reader As XmlReader
Dim transform As New XslCompiledTransform
Using reader = XmlReader.Create(New StringReader(xsltString))
transform.Load(reader)
End Using
Dim results As New StringWriter
Using reader = XmlReader.Create(New StringReader(inputXml))
transform.Transform(reader, Nothing, DirectCast(results, TextWriter))
End Using
Return results.ToString
End Function
questo fatto così mi genera questo errore:
XSLT compile error Inner Exception
xmlException:Data at the root level is invalid. Line 1, position 1.
ho provato anche a modifcarle con la versione integrale di quello che avevo trovato a giro, che era così fatto
Public Shared Function TransformXMLToHTML(ByVal inputXml As String, ByVal xsltString As String) As String
Dim reader As XmlReader
Dim transform As New XslCompiledTransform
Using reader = XmlReader.Create(New StringReader(xsltString))
transform.Load(reader)
End Using
Dim results As New StringWriter
Using reader = XmlReader.Create(New StringReader(inputXml))
transform.Transform(reader, Nothing, DirectCast(results, TextWriter))
End Using
Return results.ToString
End Function
in questo ultimo caso invece, mi dava errore il reader
variable "reader" hides a variable in an enclosing block.
i fogli di stile prelevati sono:
1 - Agenzia dell'entrate
2 -Assoinvoice