The X-Team through HTML Eyes
You may be approaching the X-Team after having already worked with HTML.
If so, when you look at XML and XSLT, its natural to view these new technolo-
gies through HTML eyes. Having a knowledge of HTML definitely gives you a
head start in learning XML syntax; noting the similarities and differences
between them is important.
Although I compare HTML and XML in this section, remember that XSL and
XSLT stylesheets are both written using XML, so the same rules apply to them
as to XML.
XML looks a lot like HTML . . .
If you can read HTML, you quickly see that XML looks an awful lot like HTML
in terms of its syntax. For example, a document title in HTML is defined as
<title>My Document Title</title>
Like HTML, the element is the primary building block of XML. Therefore, a
book title in XML might be defined to look something like this:
<book>War and Peace</book>
Additionally, XML follows HTML in using name-value pairs inside elements to
provide additional descriptive information about an element.
<company>Polar Salsa Corporation</company>
In this XML snippet, the id attribute provides additional information related
to the invoice element.
But XML isnt the same as HTML . . .
HTML and XML have a definite likeness, but you should watch out for some
significant variations in syntax rules. The three most important are as follows.
XML is well-formed
HTML has always been lenient in some of its syntax requirements, not always
forcing you to have closing tags on some of the elements, such as the para-
graph (<p>) element. For example, both of the following lines are valid HTML:
Chapter 1: Introducing the X-Team