Why XML can't be displayed directly

Why - because CSS support isn't good enough! As I've charged in a few fora,
it looks to me like halfway CSS implementations are dragging "creative"
HTML into the mix as a necessary crutch for display of structured
information. And this is very convenient if you'd like neither to have to
pay attention to HTML's design strengths nor ever to have to think of XML
as a document format, suitable for viewing with a simple stylesheet rather
than being dependent on a transformation engine and an extraneous HTML
"template".

Below is an exercise in simple transformation of Potted Plant Markup
Language (PPML) instances to HTML. Basically it's a bunch of nested DIVs
with class/id attributes to preserve the original XML semantics.

Check out the rendering. It's broken in the few CSS browsers I've tested.
The brown boundary should completely contain the black (as the pot contains
the dirt), and the black should completely contain the dark green "stems".
This failure isn't a surprise to me, but it does explain simply why, say,
XSL stylesheets will be used more frequently to produce GIF-and-table-style
HTML from XML rather than HTML that can be restyled, and that might
actually preserve the relevant structure and semantics of the source.

<html>
	<head>
		<title>
			Greenhouse
		</title>
		<style type="text/css">
DIV {padding: 1em; }
.pot {background: brown; }
.dirt {background: black; color: white; }
.stem {background: green; }
.leaf {background: #0F0; color: red; }
		</style>
	</head>
	<body>
		<div class="pot">
			 I contain everything. I am called root, not to be confused
with roots. Kettles are black.
			<div class="dirt">
				 Containing, I am contained.
				<div class="stem" id="1">
					 I came first.
					<div class="leaf">
						 I'm a leaf.
					</div>
				</div>
				<div class="stem" id="2">
					 but I'm less fibrous.
					<div class="leaf">
						 I'm a leaf too.
					</div>
				</div>
				<div class="stem" id="3">
					 I'm the baby.
					<div class="leaf">
						 I'm the widdewest weaf.
					</div>
				</div>
			</div>
		</div>
	</body>
</html>

__________________
Todd Fahrner
mailto:fahrner@pobox.com
http://www.verso.com/agitprop/

Received on Wednesday, 15 April 1998 14:27:13 UTC