[
Lists Home |
Date Index |
Thread Index
]
- From: "Hunter, David" <dhunter@Mobility.com>
- To: XML Developers' List <xml-dev@ic.ac.uk>
- Date: Thu, 27 May 1999 12:05:57 -0400
Apologies for coming in late to this thread, but I would like further
thoughts on a point of view which has been marginally mentioned, if at all,
which is the point that XSL can add a layer of abstraction to web
development that the DOM/CSS can't.
My point is, in the web development world, there are three kinds of people:
-people who write CONTENT
These people can use XML
-people who FORMAT web sites (designers)
These people can use XSL, to transform the XML into HTML/CSS
-people who write CODE
These people can use the DOM, with whatever programming languages they want,
to populate databases, or to pull information out of the databases and into
XML, or to calculate tax on the order our customer just entered, etc. etc.
etc.
I mean, think about the mess that was created when ASP first came on the
scene: People took a technology with a lot of promise, but took it too far,
and ended up with ASP pages that had HTML mixed with scripting code mixed
with content, and ended up with an unmanageable mess of, well, TEXT. Then
people got a bit wiser, and started creating server-side components, which
the ASP can call. Now we've eliminated the code from the ASP page, except
the little bit that we need to call the components; we're just left with
just HTML and content. This is more manageable. (Apologies if I've just
mangled history, but it's what I've seen at a lot of my clients.)
Now, if we go to the paradigm I've mentioned above, we can have our content,
formatting, and code COMPLETELY separate from each other. If our content
providers want to change their content, they can edit the XML files to their
hearts' content, without ever having to see code or caring about format. If
our formatters decide they want to change the layout of the site, they can
edit the XSL stylesheets and CSS stylesheets to their hearts' content,
without ever seeing a line of code, or caring about content. And the coders
simply have to pull in those XML files and XSL files, without caring what's
in them, and write the code to glue them together. (Along with the tax
calculations, etc... :-)
OTOH, if we take XSL out of the picture, then our formatters have no options
other than to
a) change the layout of the XML documents, which will interfere with our
content providers
or
b) use the DOM and write code to format the documents, which will interfere
with our coders. (And make our formatters coders themselves.)
For example, suppose we have the following XML document:
<?xml version='1.0'?>
<Employee IncrediblyGoodLooking='true'>
<Name>
<FirstName>David</FirstName>
<MiddleName>John Bartlett</MiddleName>
<LastName>Hunter</LastName>
</Name>
<Occupation>Web Development Consultant/XML-Dev Newbie</Occupation>
<Aside>Okay, he's good looking, but only in his own mind...</Aside>
<id>123456</id>
</Employee>
And we want to format the document as in the simple attached HTML file. As
you can see, the format of the HTML document is <em>completely
different</em> from the format in the XML document, even though all of the
information is there. But our formatters don't have to write code to do it,
they can use XSL, and our content providers don't care, they can just use
the same XML DTD or Schema they've always been using. The coders just have
to pull in the XML, pull in the XSL, and spit out the end result. (I did it
in ASP, with Microsoft's IE5 XML parser. It took ~7 lines of code in
VBScript.)
In case anyone is interested, the XSL I used to create the attached HTML
file is pasted below. Apologies if it could have been done better, but this
is the first time I've used XSL. (I'm using the XML parser that comes with
IE5.)
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>Employee <xsl:value-of select="Employee/id"/></title>
<style>
p
{
MARGIN-LEFT: 2cm
}
h1
{
FONT-FAMILY: Arial;
FONT-SIZE: 19pt
}
h6
{
FONT-FAMILY: Arial;
}
body
{
FONT-FAMILY: Arial Narrow
}
</style>
</head>
<body>
<h1><xsl:value-of select="Employee/Occupation"/></h1>
<p><b>Name</b>: <span><xsl:value-of
select="Employee/Name/FirstName"/> <xsl:value-of
select="Employee/Name/MiddleName"/> <xsl:value-of
select="Employee/Name/LastName"/></span></p>
<p><b>Incredibly Good Looking</b>: <input title='Incredibly
Good Looking' type='checkbox'><xsl:if
test="Employee/@IncrediblyGoodLooking[.='true']"><xsl:attribute
name="CHECKED"/></xsl:if></input></p>
<h6><xsl:value-of select="Employee/Aside"/></h6>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Of course, the drawback to this is that if a page needs client-side script,
our formatters STILL have to mix code with display.
Thoughts? Flames?
Employee 123456.htm
|