XHTML Output
R. Alexander Milowski
milowski@sims.berkeley.edu
School of Information Management and Systems
#1
"Good" XHTML
Valid against a DTD or XML Schema:
No fabricated elements (e.g. "center" ).
Containment is correct.
Text is in the right place.
XHTML constructs are used in a "semantically correct" way.
CSS is used for styling.
#2
Fabricated Elements & Structure
There is no "center" tag.
Read the specification if you aren't sure.
#3
Paragraphs Are Containers
Don't use the break line tag: <br/>
You can do the same thing with CSS much more elegantly (and with more features).
This is not a good use of XHTML:
Here is my paragraph<p/> Here is another one<br/>
And this is better:
<p>Here is my paragraph</p>
#4
Tag Soup and Presentation
Don't use some jumble of elements just to get it to look right.
Use CSS to get it to look right.
For example:
<p class="author-name">Alex Milowski</p>
and the CSS:
p.author-name { font-size: 20pt; font-weight: bold; text-align: center; }
#5
Setting Up Validation
There really isn't an official XML Schema for XHTML yet.
So you need to use a DTD.
If you want XHTML, put this in your stylesheet:
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
If you want HTML, put this in your stylesheet:
<xsl:output method="html" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
#6
W3C Validation Service
The W3C can check your output for you.
You upload you file.
Or point it at your website.
It tells you what is wrong.