Programming

Programming intro
Java

Markup

First webpage guide
HTML
XHTML

Style & Layout

CSS

Browser scripting

Javascript
VBScript
AJAX

Server scripting

PHP
ASP

Making money online

Make money online

Writing and validating a transitional XHTML document

This tutorial focuses on writing and validating a transitional XHTML document in:

Windows

Consideration

Consider first, if the XHTML document you are creating should be a transitional XHTML document, and not one of the other XHTML document types. A transitional XHTML document is one that uses some deprecated features such as HTML's <font> tag, and can also be used for documents that will be displayed in browsers that do not support Cascading Style Sheets. If you are writing an XHTML document with this purpose in mind, then it should indeed be a transitional XHTML document. Otherwise, you may want to use one of the other XHTML document types. To learn more about the different XHTML document types, read our XHTML document type definition lesson.

The writing process

  1. Open notepad by going to Start -> Programs -> Accessories -> Notepad OR go to Start -> Run - Type notepad and press Enter.
  2. Type in the following code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 
    1.0 Transitional//EN" "http://www.w3.org/TR/
    xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Transitional document</title>
    </head>
    <body>
    This is a transitional XHTML document.
    </body>
    </html>
    
  3. Save the file as transitional.html

    NOTE: Make sure that you give the file a .html extension and that you save it as type 'All Files', otherwise you will get plain text.

  4. Open your web browser.

  5. Type into the web browsers location bar the absolute location of the directory where you saved your file along with the file name. For example, if you saved the file in C:\windows, type C:\windows\transitional.html into the web browsers location bar.

  6. You should now see an XHTML transitional document in your web browser which looks like this:

    Document result

The validation process

Now that you have written a transitional XHTML document, it's time to validate it.

  1. Go to the W3C Markup Validator, located at http://validator.w3.org.

  2. The W3C Markup Validator gives you the option of validating a document by URL, by File Upload, or by Direct Input. In this tutorial, you will be validating the document by File Upload. Find the label that says "Local File:" and click the button that says "Browse...." which is directly parallel to it.

  3. Locate the file on your hard drive, and when you are ready to validate the document, click the button that says "Check"

  4. If the document did not validate, you should get a message saying "This page is not Valid XHTML 1.0 Transitional!"

    Possible reasons for the document not validating:

    • Missing closing tags
    • Tags not closed in the right order
    • Attribute values not quoted properly
    • A missing <!DOCTYPE> declaration

    Read the description of the error(s) that the Markup Validator provides. It is usually very descriptive.

  5. If the document did validate, you should get a message saying "This Page Is Valid XHTML 1.0 Transitional!"

    You now have a valid XHTML transitional document!! This means "that you have taken the care to create an interoperable Web page" as is stated by the W3C Markup Validator.

Linux

Consideration

Consider first, if the XHTML document you are creating should be a transitional XHTML document, and not one of the other XHTML document types. A transitional XHTML document is one that uses some deprecated features such as HTML's <font> tag, and can also be used for documents that will be displayed in browsers that do not support Cascading Style Sheets. If you are writing an XHTML document with this purpose in mind, then it should indeed be a transitional XHTML document. Otherwise, you may want to use one of the other XHTML document types. To learn more about the different XHTML document types, read our XHTML document type definition lesson.

The writing process

  1. Open nano and type in the following code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 
    1.0 Transitional//EN" "http://www.w3.org/TR/
    xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Transitional document</title>
    </head>
    <body>
    This is a transitional XHTML document.
    </body>
    </html>
    
  2. Save the file as transitional.html

  3. Open your web browser.

  4. Type into the web browsers location bar the absolute location of the directory where you saved your file along with the file name. For example, if you saved the file in /home/user1/desktop, type /home/user1/desktop/transitional.html into the web browsers location bar.

  5. You should now see an XHTML transitional document in your web browser which says "This is a transitional XHTML document."

Screenshot for Linux coming soon..

The validation process

Now that you have written a transitional XHTML document, it's time to validate it.

  1. Go to the W3C Markup Validator, located at http://validator.w3.org.

  2. The W3C Markup Validator gives you the option of validating a document by URL, by File Upload, or by Direct Input. In this tutorial, you will be validating the document by File Upload. Find the label that says "Local File:" and click the button that says "Browse...." which is directly parallel to it.

  3. Locate the file on your hard drive, and when you are ready to validate the document, click the button that says "Check"

  4. If the document did not validate, you should get a message saying "This page is not Valid XHTML 1.0 Transitional!"

    Possible reasons for the document not validating:

    • Missing closing tags
    • Tags not closed in the right order
    • Attribute values not quoted properly
    • A missing <!DOCTYPE> declaration

    Read the description of the error(s) that the Markup Validator provides. It is usually very descriptive.

  5. If the document did validate, you should get a message saying "This Page Is Valid XHTML 1.0 Transitional!"

    You now have a valid XHTML transitional document!! This means "that you have taken the care to create an interoperable Web page" as is stated by the W3C Markup Validator.

Mac

Coming soon..

Step-by-step tutorials
Programming intro
HTML
XHTML
CSS
Javascript
Java

Practice

Online code editor
Practical examples
Practical exercises

Reference

Terms glossary
Reference material

Rate this site

Rate this site
Visitor comments