472,354 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

XML to HTML using XSLT

Hi All

I'm trying hard to find out how to transform XML to HTML using XSLT files.

I have searched all over for some examples on how to do this, but I have had
no succes with any of them.
Can sombody please direct me on how to fill in this function:
Public Function XmlToHtml(ByVal xmlString as string, ByVal xsltPath as
string) as string
'xmlString being a string containing the XML to be transformed
'xsltPath being the path to the actual XSLT file containing the
transform styles

Dim ResultHTML as string

'???????

Return ResultHTML
End Function
I have worked with XslTransform and XPath, but can't seem to work it out.
Thanks in advance

Allan Bredahl
Jul 21 '05 #1
2 1628
"Allan Bredahl" <ad***@bredahl.org> wrote:
I'm trying hard to find out how to transform XML to HTML using XSLT files.
I have worked with XslTransform and XPath, but can't seem to work it out.


In my apps I use the following function, however, I'm transforming
file to file, not string to string, as my documents can get quite
sizeable. It may give you something to go on - I'd imagine there's a
version of xsltransdform.transform that accepts a string, I'm not in a
position to look at the moment.

Public Sub DoTransform(ByVal InputFile As String, ByVal OutFile As
String, ByVal StyleSheetFile As String)
Dim xslt As New Xsl.XslTransform
xslt.Load(StyleSheetFile)
xslt.Transform(InputFile, OutFile, Nothing)
End Sub

Jul 21 '05 #2
"Brett O'Callaghan" <br*************@hotmail.com> skrev i en meddelelse
In my apps I use the following function, however, I'm transforming
file to file, not string to string, as my documents can get quite
sizeable. It may give you something to go on - ......


Hi

Thanks for your reply.

I have now found a solution, mostly by luck I believe :) :

Private Function TransformXML(ByVal xml As String, ByVal xsltPath As
String) As String
Dim trans As New XslTransform
Dim doc As New XmlDocument
Dim html As String
Dim writer As StringWriter = New StringWriter

trans.Load(xsltPath)
doc.LoadXml(xml)
trans.Transform(doc, Nothing, writer, Nothing)
html = writer.ToString
writer.Close()
Return html
End Function 'Main

/Allan
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
2
by: Sylvia | last post by:
Hi, I'm trying to render a XML structure to HTML using XSLT. My XML describe the header of a table with a complex and not linear structure. The first row of the header table always contains the...
5
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
2
by: Allan Bredahl | last post by:
Hi All I'm trying hard to find out how to transform XML to HTML using XSLT files. I have searched all over for some examples on how to do this, but I have had no succes with any of them. ...
3
by: Andy Dingley | last post by:
>From a thread over in c.i.w.a.h "RFC: From XHTML to HTML via XSLT" http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86 As is well-known, the XSLT HTML...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
3
by: messagewalker | last post by:
Hello All, I am stuck with a problem. I have an xml file as follows <parent> <publisher> <name>somename</name> <book1>data1</book1> <book2>data2</book2> <book3>data3</book3>
6
by: Muthu08 | last post by:
Hello Experts, I'm trying to convert an dynamic XML doc into HTML using XSLT. In the example I have shown one form(form1)...But there could be multiple forms....names are unknown and each one...
18
by: malathib | last post by:
Hi, while trasforming xml to html using xslt, i dont want to lose xml tags.I want to preserve it. After transforming to html and displaying in browser and if you are right clicking and viewing...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.