Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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()
        Try
            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.Load("c:\transform.xsl")
            Transformer.Transform(xmlfilename, htmlfilename)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        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.

Cheers

Reply With Quote
  #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
Default

Hi ewan,

http://msdn.microsoft.com/library/de...classtopic.asp


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)

otherwise

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

Regards
Bryan




Reply With Quote
  #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
Default

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

Thankyou so much for your help

Ewan

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:31 AM.


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