XMLファイル(abcde.xml)をXSLT(henkan.xsl)ファイルによりHTML(Output.html)に変換してみます。
XML:eXtensible Markup Language
XSLT:XSL Transform
XSL Transform については「
簡単な XSLT を使って XML を変換してみよう!」も見てみてください。
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports System.Xml.Xsl
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim xslt As New XslCompiledTransform
Dim xpathDoc As New XmlTextReader("abcde.xml")
Dim outStream As New FileStream("Output.html", FileMode.Create)
Dim twriter As New StreamWriter(outStream, System.Text.Encoding.GetEncoding("utf-8"))
Dim xwriter As New XmlTextWriter(twriter)
xwriter.Indentation = 4
xwriter.Formatting = Formatting.Indented
xslt.Load("henkan.xsl")
xslt.Transform(xpathDoc, Nothing, xwriter, Nothing)
xslt = Nothing
xpathDoc = Nothing
twriter.Close()
xwriter.Close()
outStream.Close()