The L-Space Web: Developers

XHTML


XHTML is not that different to HTML4.

The key differences are:

Element and attribute names must be in lowercase
XML is case-sensitive so<li> and <LI> are different tags

All elements must nest
<p><em>...</p></em> is incorrect and should be written <p><em>...</em></p>

Attribute values must always be quoted - even numbers
Example: <table rows="3">

Non-empty elements must have closing tags
Example: <p>Here is a paragraph</p>

Empty elements must end with /.
Example: <br /> and <hr />

Due to the differing support of current standards, it is always advisable to check your page with more than one browser. Netscape 4.x, for example, is known to be especially problematic when rendering style sheet information.

Validating your XHTML pages

There are several online validators to assist you in checking your page for xhtml compliance.
We suggest using the following:

There are advantages and disadvantages with any given validator, so it is advisable to check your pages with both of the appropriate W3C and WDG validators.

Although not useful for everyone, Javascipt bookmarklets have been created that enable you to check your uploaded web page. Just add them to your bookmarks, navigate to the page to be validated and select the bookmark whilst on that page.

When converting old HTML pages to XHTML, or developing new pages, you may be able to save yourself some work by using Dave Raggett's Tidy tool: http://www.w3.org/People/Raggett/tidy/

Configure Tidy, in Linux, with the following options:

tidy --wrap 75 --output-xhtml true --doctype auto --quote-marks true --clean true --logical-emphasis true --write-back true --gnu-emacs yes <filename>

But be aware that this will in fact cause the file to be overwritten. And that for L-Space work you will have to do some extra work to amend Tidy's changes back to .h4 files.

If using Tidy within Windows, create a plain text file that contains the following:

// HTML Tidy configuration file created by TidyGUI
wrap: 75
tidy-mark: no
clean: yes
logical-emphasis: yes
output-xml: yes
output-xhtml: yes
quote-marks: yes
quote-nbsp: no
quiet: yes

Save the file as "lspace-tidy" ( no .txt extension) and then load it via Tidy's Configuration¦Load option when checking Lspace pages. Unlike the setting used within the Linux version, this will not overwrite the original file but you can copy-and-paste the results of Tidy's output via the Show Output option.


[Prev Page] [Up] [Next Page]
This section of L-Space is maintained by The L-Space Librarians

The L-Space Web is a creation of The L-Space Librarians
This mirror site is maintained by Colm Buckley