comp 1950 > week 2: tools & xhtml

agenda

  • Web review: some reminders
  • Web Development with Firefox
  • Homesite introduction
  • XHTML
  • Assignment & Homework

XHTML - What is it?

  • Evolution from HTML to XHTML
  • X = eXtensible
  • X = XML related
  • A reformation of HTML reformulated in XHTML.
  • First major update to HTML since the 4.0 specification was released in 1997.
  • Mature specification, which is currently at 1.0, with 2.0 just around the corner (the 6th working draft of 2.0 was just released on July 22nd, 2004).

Why XHTML?

  • Better, more predictable coding patterns
  • "verifiable" or "well-formed" code can be produced
  • Many coders kept a poor standard on their HTML
  • Browsers were forgiving in coding errors or omissions
  • Coders/designers became lazy, some exploited known rendering problems

What advantages does XHTML have over HTML?

  • Forces coders to adhere to a common standard
  • Code can be manipulated by applications
  • Interoperability with XML (eXtensible Markup Language), XSLT (Stylesheet Transformations), XHTML Modularization, MathML and SVG.

What is different about XHTML?

  • Almost identical to HTML 4.01, but a much stricter syntax in XHTML
  • Technically: XHTML is just HTML defined as an XML application.

XHTML Rules:

  1. All elements must be properly nested
  2. All tags must close
  3. Empty Elements are closed as well: An extra space is required before the slash to work with all browsers.
  4. All tag names must be in lower case
  5. Attribute names are always in lower case
  6. All attributes must be quoted
  7. Attributes cannot be minimized
  8. Name Attribute is no longer used. Replace with id. In order to work with new and older browsers, use both name and id as an interim measure (however, you may get a warning about using the name attribute).

Mandatory Elements

Every XHTML document must have these elements:

  • The doctype declaration *must* be there, but it is part of the document rather than an element of the document.
  • To be listed as a valid XHTML document, it must conform to all of the above rules

Optional XML declaration

  • While this declaration is not required, it is highly encouraged:

XHTML Documents

DTD: Document Type Definition

  • A description of the document, and the legal definitions that fall within it.
  • The DTD defines the syntax of the page in SGML.
  • This translates to: Because XHTML is just the application of XML to HTML, you need to tell the browser (the interpreter) how to interpret all of the code on the page.

Three kinds of DTD:

Strict

  • Mostly used for technical documents or content that requires very little markup.
  • This is the original intention of the W3C"s recommendation.

Transitional (most common)

  • This is by far the most common DTD in use today
  • Supports most HTML features
  • Was created to provide a middle ground for users trying to convert from HTML to XHTML in stages.
  • Will be the class standard

Frameset

  • Same as Transitional, but allows the use of frames

Example of an XHTML Document

Validate your code:

http://validator.w3.org/

assignment & homework

Course Website

  • Convert your course website over to XHTML Transitional
  • Link to the W3C Validator (http://validator.w3.org/) from your Week 2 Assignment page
  • Pages have to be on the net (not your computer filesystem) for the referer validation to work!

Quiz (sort-of)

  • For next week
  • Convert this XHTML Quiz to an XHTML-Strict page
  • Think about how to strip the code of extraneous garbage
Note: if the W3C Validator complains that there is no character encoding found, use this META tag in the HEAD of your document:

Strict:

Transitional: