TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML/XSLT (was: Re: [TCLUG:13752] HTML (again))



Troy Johnson wrote:
> 
> Just injecting my opinion...
> 
> Because this is an email list, I think we should, as a rule, try to
> accomodate the lowest common denominator in mail readers. Why must we
> sacrifice straight text to the god of HTML? So we can have underlining,
> bold face and italic type, and URL links without that messy HTTP
> protocol info (though some people like to see that stuff). I can live
> without these conveniences, even though they are at my disposal (beacuse
> my preferred browser is HTML capable), so I wonder if they are truly
> that important (on a email list).

Since I didn't feel like whining again about e-mail formatting, I
started looking around for possible replacements for HTML mail.  In my
opinion, straight ASCII is too minimal.  HTML looks nice, but usually
only in a graphical environment (IMHO).  An interesting combination that
I found is that of XML (Extensible Markup Language) paired with XSLT
(Extensible Stylesheet Language Translation).

As you may know, XML is being used as a language for storing and
transmitting data of many different types.  An individual XML document
is like a mini database--it holds records of different kinds of data
(well, it can be bent around to do all sorts of interesting things). 
For instance, an XML address book document might look something like

<?xml version="1.0"?>
<addressbook>
  <person>
    <name>Mike Hicks</name>
    <contact type="email">hick0088@tc.umn.edu</contact>
    <contact type="phone">555-1212</contact>
    <contact type="url">http://umn.edu/~hick0088</contact>
    <note>A really great guy ;-)</note>
  </person>
  <person>
    <name>Jorgi Jorgesson</name>
    <contact type="phone">123-4455</contact>
    <note>More evil than Phil, the Prince of Insufficient Light.</note>
  </person>
</addressbook>  

Everything in that document actually means something useful, rather than
an HTML document that would have a similar effect:

<html>
  <head>
  <title>My Addressbook</title>
  </head>
  <body>
    <h2>My Addressbook</h2>
    <p><b>Mike Hicks</b><br>
       E-Mail: <a
href="mailto:hick0088@tc.umn.edu">hick0088@tc.umn.edu</a>
       URL: <a
href="http://umn.edu/~hick0088">http://umn.edu/~hick0088</a>
       Phone: 555-1212</p>
    <p><b>Jorgi Jorgesson</b><br>
       Phone: 123-4455</p>
  </body>
</html>

With HTML, most of the tags that are there are around for _formatting_,
as opposed to the tags in the XML document which define _content_.  You
can still have XML tags that influence formatting, it all depends on how
you use the tags..  However, XML is much more strictly defined than
HTML, so it is often difficult to extract useable data from an HTML
document.  Small formatting changes can make a perfectly crafted script
barf all over the place, and conversion from HTML to ASCII or any other
format is not always very reliable.  (The example of HTML I have above
is actually very understandable, much better than what is often in the
'real world.'  I could have made it look a lot worse if I tried ;-)

Anyway, I guess what I'm getting to is that I think XML would be a great
way to encode e-mail.  I didn't always think that way, but then I found
XSLT.

If you have all of your data in an XML file, it doesn't really do you
any good unless you can find a way to retrieve it in an easy way.  XSLT
is to XML what PHP or ASP is to a database.  It translates the pure
content of an XML document into a new text-based document that can
contain all sorts of nice formatting.  Of course, you could do a
straight XML->XML conversion if you like..  XML, HTML, SGML, PostScript,
TeX, Rich Text Format, and some other popular document formats are all
based on ASCII text, so XSLT can readily translate XML into any of
them.  To me, this sounds like a very, very good thing.  The HTML people
can have their HTML, the ASCII people can have their ASCII, and so
forth.

Now I just have to figure out a good DTD..  hmm..

-- 
 _  _  _  _ _  ___    _ _  _  ___ _ _  __   Famous last words - You 
/ \/ \(_)| ' // ._\  / - \(_)/ ./| ' /(__   and what army? 
\_||_/|_||_|_\\___/  \_-_/|_|\__\|_|_\ __)                             
 [ Mike Hicks | http://umn.edu/~hick0088/ | mailto:hick0088@umn.edu ]