Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 4th, 2004, 08:21 AM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting an XML File into a HTML File

Hi I am a VB.Net Newbie so be patient with me.

I am trying to convert a XML file into a HTML Document using the XSLTransform method. I want to do this in a VB.Net Windows Application as opposed to a Web Application. I have managed to generate an XML Document using XMLWriter but I get errors when trying to use the XSLTransform.Transform Method.

The current error I have is as follows:

"public sub transform(inputfile as string, outputfile as String) is obsolete: 'You should pass XMLResolver to Transform() method"

My code is:

    Public Sub ExportAsHTML()
            Dim xmlfilename As String = "c:\new.xml"
            Dim xslfilename As String = "c:\transform.xsl"
            Dim htmlfilename As String = "c:\new.html"
            Dim Transformer As New XslTransform
            Transformer.Transform(xmlfilename, htmlfilename)
        Catch ex As Exception
        End Try

    End Sub

Can someone please post an example of a windows application that converts an xml file into a html file using XSLTransform method in VB.Net.

Any help would be much appreciated.


  #2 (permalink)  
Old October 4th, 2004, 08:48 AM
Authorized User
Join Date: Jul 2004
Location: Oxford, , United Kingdom.
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts

Hi ewan,


You are almost there, if your transformation does not require a Url Resolver then just pass Nothing as the third argument to the Transform.

Transformer.Transform(xmlfilename, htmlfilename, Nothing)


Dim Resolver As New System.Xml.XmlUrlResolver
Transformer.Transform(xmlfilename, htmlfilename, Resolver)


  #3 (permalink)  
Old October 4th, 2004, 09:12 AM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Bryan. Thanks to your explanation I was able to produce a HTML File from my XML Document.

Thankyou so much for your help


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting a HTML file to png file timcyberbanjo General .NET 0 October 21st, 2008 04:30 PM
Converting Excel file into a text file zone Excel VBA 3 July 26th, 2007 02:09 PM
Sql query output to XML or HTML file miamikk SQL Language 4 June 6th, 2007 03:58 AM
viewing xml inside an html file Tomi XML 1 August 2nd, 2006 05:06 AM
Converting excel file into XML... muskaanbajaj ASP.NET 1.0 and 1.1 Professional 3 April 3rd, 2006 12:33 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.