473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 1715
"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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.