[thelist] XML to HTML
Ray Hill
lists at prydain.com
Fri May 11 23:04:17 CDT 2001
> I'm wanting to know how to have the xml/xslt results
> dumped into an html page. I've come up with something
> (based off follwing and reading several tutorials..)
> but it farts in netscape, and when you vew source,
> the data doesn't show up. Am I needing a server side
> parser(?).
IE 5 has a built in XML processor, so the pages you sent
(with a few minor corrections - details below) do produce
the desired effects when the XML document is viewed in
IE 5. But if you want to make a page that's viewable
by pretty much any browser, you *will* need to have an
XML processor on the server side that translates the XML
into HTML, then sends just the HTML to the server.
The reasons your files don't currently work, are:
1) In the XML document, you use an ampersand ( & ) in the
second <name> tag. In order to prevent the XML parser
from choking, you have to replace that with &.
[Note: This is also true when you're writing URLs with
arguments in the query string, such as:
http://example.com/servlet?oneFish=red&twoFish=blue]
2) In the XSL document, there is no closing </html> tag.
Since an XSL document is an XML document, it *has* to
be well formed.
Fix those two errors and you'll be able to see the
results in IE 5. (Although I'd also change the colors
a bit if I were you, since black text on a dark grey
background is difficult to read).
The best way to avoid mistakes like these are to
create your files in an editor that does well
formedness validation for you as you type. A great
one that can be downloaded and used for free is the
xRay editor from Architag.
http://www.architag.com/xray/
For a great XML/XSL resource, check out Wrox's new
"Professional XSL" book that Wrox just published.
It just hit the shelves last week, but it's the
*only* reason I'm going to be hitting my current
deadline on time (an XSL project, when I had never
used XSL before last week).
Since I'm just learning myself, I can't give you a
lot of details on how the processor works, or how to
install it. But that is covered a bit in the book.
Professional XSL - by Kurt Cagle, et al
http://www.amazon.com/exec/obidos/ASIN/1861003579/o/qid=989621040/sr=8-1/ref=aps_sr_b_1_1/107-2059787-4844515
--ray
More information about the thelist
mailing list