Procedura per utilizzare le trasformazioni XSLT senza dover ogni volta salvare il file ottenuto e quello in input per la trasformazione... Per fare ciò è possibile utilizzare le memory stream come descritto:
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim reader As New XmlTextReader(ds.GetXml(), XmlNodeType.Document, Nothing)
' Leggo il file XSLT
Dim xslfile As String = IO.Path.Combine(Request.PhysicalApplicationPath, "xslt\Trasformazione.xslt")
Dim x As New Xsl.XsltSettings
x.EnableScript = True
x.EnableDocumentFunction = True
Dim tra As New Xsl.XslCompiledTransform
tra.Load(xslfile, x, Nothing)
' Trasformo la DataTable XMLizzata in HTML
Dim ms As New MemoryStream
Dim myWriter As New XmlTextWriter(ms, Nothing)
Dim myXPathDoc As New XPath.XPathDocument(reader)
tra.Transform(myXPathDoc, Nothing, myWriter)
Utility.ConvertToString(ms)
alla fine è possibile utilizzare una funzione che converte la memorystream in una stringa.
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento