Credit: Jon A. Morse (ST Sci/NASA)
There exist several ways to convert XML to HTML for display on the Web.
- Using HTML alone.
If your XML file is of a simple
tabular form only two levels deep then you can display XML files
using HTML alone (see the next chapter for an example)
- Using HTML + CSS . This is a substantially more
powerful way to transform XML to HTML than HTML alone, but lacks the
full power and flexibility of the methods listed below
- Using HTML with JavaScript.
Fully general XML files of any type and complexity can be processed and
displayed using a combination of HTML and JavaScript. The advantages
of this approach are that any possible transformation and display
can be carried out because JavaScript is a fully general purpose
programming language. The disadvantages are that it often requires
large, complex,
and very detailed programs using recursive functions (functions
that call themselves repeatedly) which are very difficult for most
people to grasp
- Using XSL and Xpath.
XSL (eXtensible Stylesheet Language) is considered the best way to
convert XML to HTML. The advantages are that the language is very
compact, very sophisticated HTML can be displayed with relatively
small programs, it is easy to re-purpose XML to serve a variety of
purposes, it is non-procedural in that you generally specify only
what you wish to accomplish as opposed to detailed instructions
as to how to achieve it, and it greatly reduces or eliminates
the need for recursive functions. The disadvantages are that it
requires a very different mindset to use, and the language is
still evolving so that many XSL processors in the Web servers
are out of date and newer ones must sometimes be invoked through DOS
|
|
 |
|
 |