473,396 Members | 2,061 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,396 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 1724
"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.