Answering Service and Virtual Secretary Services  
Virtual Secretary Services and Remote Receptionist

Practical XHTML




Answering Service > Call Center Resource > Web Development and Promotion > Web Development > Practical XHTML

Practical XHTML

by Peter Sawczynec

This explanation is specifically geared to aid a web developer gain enough practical XHTML (Extensible Hypertext Markup Language) to start using XHTML promptly. If you would like a full technical explanation of what XHTML is as it relates to its XML and SGML heritage, go to the W3C site and follow the XHTML link.
Browsers processing HTML typically will gracefully accept coding errors and still display the gross page content. Browsers are designed to be more strict when processing XHTML. Essentially, XHTML code must be well-formed. For daily use, this translates to:

[ ] tag names have to be correct
[ ] tag attributes and their values have to be correct
[ ] non-empty tags must be opened and closed correctly
[ ] tag nesting must be correct
[ ] header information is expected to be there and must be correct

XHTML is meant to improve the quality, reliability and interoperability of all web code and should be used.

What Makes Well-formed XHTML
Heres the practical nitty-gritty. The XHTML document must be well-formed by these XML rules:
XML is case sensitive.
All element tag names and attribute names must be lowercase. E.g.
is not valid.
is valid.
Non-empty elements must have closing tags. E.g.:

text is not valid,

text

is valid.
Further,

is not valid to create a paragraph break,

is valid.
Allowed empty elements must end with a space and a final forward slash. E.g.

is not valid,

is not correct,

is correct.
is correct.
The extra space ensures that 4.0 version browsers do not choke on the XHTML tags.
All attribute values must be "quoted". E.g.
is not valid,
is valid.
Attribute minimization is not allowed. E.g.
nowrap or checked must be specified as nowrap="nowrap" and checked="checked"
Attribute values cannot have hard returns in them
Leading and trailing spaces in attribute values will be trimmed away.
Only the id attribute can uniquely identify an element. The name attribute should not be used. E.g.:
is not correct,
is correct.
An XHTML document should have an XML declaration first. No white space or returns are allowed ahead of it. This is the XML document declaration:



But this declaration can break older browsers and XML aware browsers dont need it. Yet, this declaration contains the character encoding attribute which is needed, so it should be declared in the subsequent metadata.

The XHTML document must have a valid DOCTYPE declaration. There are three valid ones: Strict, Transitional, and Frameset.

The first doctype declaration, Strict, typically cannot be used because it may break older browsers. Strict means the document must be valid by all XML rules and can only have W3C HTML 4.0 or higher elements. No browser proprietary tags. This is it:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> />
The second doctype declaration is the most used. Transitional declaration means the document must be valid by XML rules and can have deprecated HTML tags.This is it:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> />
The third doctype, Frameset, is like Transitional except the page can also have frames. This is the declaration:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> />
Heres what the basic XHTML document framework code would look like for an XHTML document:



http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> />http://www.w3.org/1999/xhtml"> />

XHTML Document Framework









.
.
.