PDA

View Full Version : Display XML data


truedos
12-02-2003, 12:32 PM
Hi,

What is the best way to display XML data? I knew that there are four methods to display XML data in an HTML web page, those are using: CSS - Java Script - XSL and Data Islands.

I've studied those methods, but I couldn't find out what is the best way to insure stability and compatibility, so that XML data can be viewed in all browsers and versions.

Thanks...

rescuede
12-03-2003, 03:40 PM
I tried to display XML data by using XSL,and CSS .But i would recommend ou to use XSL,although it' seems to be a little complex at the beginning.

Xml can be displayed when browser supports Xsl,(Ie 6.0,Ns 6.0,Mozilla 1.2,..)


Have fun.

brendon99
12-10-2003, 03:22 AM
I agree with truedos, if you want to get something up and running fast, go with XSL. You can combine all that you've mentioned together, but you may run into issues with browser compatibility, especially with some of the javascript (if using the XML DOM parsers).

I looked into the data islands, but steered away from them - they didn't suit my requirements, and its easier to read your XSL templates without all the data within them (and easier to maintain).

Some reference sites are:
http://www.w3schools.com/ http://www.devguru.com/

A good book on XSLT is "Beginning XSLT" by Jeni Tennison - its a WROX publication, and its been invaluable to me in learning the XSLT language - it covers a lot of situations.

M@rco
12-18-2003, 02:11 AM
Presumably you *are* referring to displaying XML to a client via a web browser? And compatibility is important? Quite right too...

- Data islands are out, because that's IE-only.

- The CSS method won't work at all on many old browsers.

- Ditto with the JavaScript + XML DOM approach (plus that will require different code for different browsers).

- And ditto again for XSLT (by which I am assuming you mean delivering a plain XML file which references an XSLT file).


In fact, your best option is to render the XML into the desired output format on the server, so that all the client receives is a plain HTML/XHTML document just like any other page on the web, and it can remain blissfully unaware of how it was generated!!

Every server-side scripting language can transform XML+XSLT nowadays, so it's really a question of picking your favourite scripting technology based on your web server platform and personal preference/experience. I'm an IIS/ASP guy but that's not necessarily the best option for you...

;)

kraftomatic
12-18-2003, 05:52 PM
I'm looking to do the same thing here .. I've read on the data islands, and while that seems quick and easy, if it's IE-specific, then that isn't a good solution.

I've worked with XSLT, but I'm a bit rusty:

I have my XML data file.
I have my XSLT file.
It spits out the result in HTML,
No matter what server I'm running on (Win2K in this case).

Right?

me'
12-20-2003, 07:48 PM
I'd recommend XML+XSLT, then a server-side language to show it, if it needs to be included alongside with other XHTML content, or just let the XSLT display it and use CSS to style if not.

kraftomatic
12-20-2003, 08:01 PM
That's what I'm just getting into now .. Thanks for the heads up.