RE: Is anyone subscribed to this list besides me?

by "Mike Furmedge" <mike(at)clockworx.co.uk>

 Date:  Thu, 15 Mar 2001 12:09:17 -0000
 To:  <hwg-xml(at)hwg.org>
 In-Reply-To: 
  todo: View Thread, Original

	Hi Kynn, I've just emptied Amazon's bookshelf on XML reference texts and
will be spending the next few weekends getting up to speed on the basics -
my primary interest in XML is because I use Com components in my websites to
return data from SQL Server and I'd like to use XSL stylesheets to reformat
that data to display it in different ways - e.g for a shopping basket or an
order summary for instance - I could use the same call to the database to
retrieve the data but display it differently for those two pages.

	So basically my interest is to make my COM components more reusable by
using XSL stylesheets with them, that and the whole versatility of XML looks
absolutely fascinating :)

Mike

-----Original Message-----
From: Kynn Bartlett [mailto:kynn-hwg(at)idyllmtn.com]
Sent: 09 March 2001 16:07
To: Mike Furmedge; Aaron Choate; hwg-xml(at)hwg.org
Subject: RE: Is anyone subscribed to this list besides me?


At 11:25 AM +0000 3/9/01, Mike Furmedge wrote:
>	My god....life!
>
>	Yeah, I subscribed to this list a while ago to see if I could
>see how to
>get started using XML with HTML but I don't think I've ever seen a post on
>it.

Yeah, to the best of my knowledge this is the smallest of the HWG's
discussion lists.

What do you want to know about? :)

XML is just a set of rules for defining markup languages.  You can
define your own XML languages or you can use someone else's.  Here's
an example of an XML language i just made up:

<?xml version="1.0"?>
<dogml>
   <dog>
     <name>Kim</name>
     <breed>Tibetan Mastiff</breed>
     <dob>25 December 1989</dob>
     <color location="body">black</color>
     <color location="toes">white</color>
   </dog>
</dogml>

It's certain things about my dog, described in an XML language.
Whoop de doo, huh?

The cool thing tho is that because I've followed the rules for XML,
I can use this with other programs and applications which work with
XML.  E.g. I can use this with an XML editor program.  I don't
have to build new tools to use my markup language.

I can also use XSLT (Extensible Stylesheet Language Transformations)
to change from one XML language to another.  For example, from
DogML to XHTML.

What's XHTML?  In the most basic sense (XHTML 1.0), it's just old
familiar HTML 4 written according to the rules of XML.

XSLT looks something like this:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0"
   xmlns="http://www.w3.org/1999/xhtml">

   <xsl:strip-space elements="*"/>
   <xsl:output method="html" indent="yes"/>

   <xsl:template match="/">
     <h tml>
       <head>
         <title><xsl:value-of select="/dogml/dog/name"/></title>
       </head>
       <body>
         <xsl:apply-templates/>
       </body>
     </h tml>
   </xsl:template>

   <xsl:template match="dog">
     <h1><xsl:value-of select="name"/></h1>
     <p>
       <b>Breed:</b>
       <xsl:value-of select="breed"/>
       <br/>
       <b>Date of Birth:</b>
       <xsl:value-of select="dob"/>
     </p>
     <h2>Colors:</h2>
     <ul>
       <xsl:apply-templates select="color"/>
     </ul>
   </xsl:template>

   <xsl:template match="color">
     <li><xsl:value-of select="."/>
         <xsl:text> (</xsl:text>
         <xsl:value-of select="@location"/>
         <xsl:text>)</xsl:text>
     </li>
   </xsl:template>
</xsl:stylesheet>

NOTE:  In the example above I have "broken" the html tag because it
confuses some email clients if I leave that in.

If you apply the XSLT stylesheet above to the XML (DogML) file, you
will get something like this:

<h tml xmlns="http://www.w3.org/1999/xhtml">
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

       <title>Kim</title>
    </head>
    <body>
       <h1>Kim</h1>
       <p><b>Breed:</b>Tibetan Mastiff<br><b>Date of Birth:</b>25 December
1989
       </p>
       <h2>Colors:</h2>
       <ul>
          <li>black (body)</li>
          <li>white (toes)</li>
       </ul>
    </body>
</h tml>

Of course, this is a trivial (read: "stupid") example, but maybe you will
find it of use.

--Kynn

--
Kynn Bartlett <kynn(at)idyllmtn.com>
http://www.kynn.com/

HWG hwg-xml mailing list archives, maintained by Webmasters